Re: [Rails] Assets not loading in production
Thanks Jordon, that's giving me a few things to go on. (Off to investigate...)
On Saturday, October 12, 2013 4:15:18 PM UTC+1, Jordon Bedwell wrote:
-- On Saturday, October 12, 2013 4:15:18 PM UTC+1, Jordon Bedwell wrote:
On Sat, Oct 12, 2013 at 9:45 AM, Phillip <phi...@gmail.com> wrote:
> I am trying to deploy my first rails app in a production environment, but
> cannot get the assets to load. The site is hosted on Webfaction, they advise
> to create a "static app" to serve the assets which I have done. But I don't
> understand how my rails app then knows about the static app.
I don't even want to know what they are talking about or implying
because it sounds wrong. By default in production on a Rails 4
application it prefers you to pass asset serving up higher in the
chain because it will be much quicker for nginx/apache to serve the
app than it will be for Rails to serve it especially considering you
have to proxy to rails who then has to send it back and then it gets
served.
This means that when you build a new app you need to make sure you
have a proper root set (or a sub-domain) that can lead to the public
folder and each time you deploy you need to do `rake
assets:precompile` to get your assets to work. If you do not wish
this to be the case then set your production.rb to serve static assets
and go on about your way as you will not need to have nginx/apache
care about it.
At that point your Rails application will know the asset path and you
will have access to public/assets/$(name)-$(hash).$(ext).
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f4e7f260-ec2c-4932-93f7-9ee8d4f5eed0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home