Nicolas Buduroi
2011-Aug-31 21:30 UTC
Issue with asset pipeline helper with Rails 3.1 final release.
Hi, I''ve just updated my app to the final 3.1 release and deployed it to the staging server after running tests but there is a problem with the precompiled assets. The precompiled assets are all in the public directory, like they were before, Capistrano doesn''t throw any error and running `rake assets:precompile` in the current directory work as expected. But the asset pipeline helpers (javascript_include_tag and stylesheet_link_tag) act like if the assets weren''t precompiled. This application have been developed from scratch for 3.1 and deployement worked flawlessly using the release candidates (last used was rc5), I''ve downgraded to our last Gemfile.lock and everything work. So, has something changed since rc5 or is this a bug. Also, when trying the run `rake assets:precompile` on my local machine I get this very strange error message: "Access denied for user ''root''@''localhost'' (using password: YES)". Running rake with `--trace` doesn''t give me any more information. I find this error non-sensical, as nothing in this project is owned by the root user. Again downgrading to rc5 make everything work as normal. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/PySXZDLSDdMJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jim Morris
2011-Sep-02 22:50 UTC
Re: Issue with asset pipeline helper with Rails 3.1 final release.
the error you are getting running rake assets:precompile locally is that you probably do npt have the production database setup locally and for some reason it tries to connect to the production database, I fixed this error by simply creating the production database locally. I can''t help with the other problem as I am still trying to figure out how to deploy these assets, they really seem more trouble than they are worth ;) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0mE3l9krLbQJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Nicolas Buduroi
2011-Sep-02 23:03 UTC
Re: Re: Issue with asset pipeline helper with Rails 3.1 final release.
On Fri, Sep 2, 2011 at 6:50 PM, Jim Morris <wolfmanjm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> the error you are getting running rake assets:precompile locally is that > you probably do npt have the production database setup locally and for some > reason it tries to connect to the production database, I fixed this error by > simply creating the production database locally. >Well, that seems to make some sense, though I don''t see why the assets precompilation would hit the database. This is working flawlessly using rc5, so something must have changed in Rails. I can''t help with the other problem as I am still trying to figure out how> to deploy these assets, they really seem more trouble than they are worth ;) >Should be relatively easy if you''re starting with 3.1, I just added this: after(''deploy:symlink'', ''assets:precompile'') namespace :assets do desc ''Precompile assets'' task :precompile, :roles => :app do run "cd #{current_path}; RAILS_ENV=#{stage} rake assets:precompile" end end to the deploy.rb file, pretty standard Capistrano stuff. Never had any problem with the RCs! But for existing project, it''s another story. One coworker tried to convert a big project and gave up after a while as this project already used many complex scss files with lots of @include statements. I''m eagerly awaiting 3.1.1! ;-) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jim Morris
2011-Sep-03 03:38 UTC
Re: Re: Issue with asset pipeline helper with Rails 3.1 final release.
I could deploy that way although the latest capistrano does seem to have a builtin for assets if you load ''deploy/assets'', however I want to precompile locally and upload the resulting public/assets. I don''t want to have to deploy all the assets stuff to my production server and precompile on the server, it makes more sense to me to precompile locally. So I''ll have to write a bunch of custom stuff for capistrano to do that. There is a discussion thread on the capistrano ML about this. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0Z_LzZm8WPYJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Nicolas Buduroi
2011-Sep-07 18:18 UTC
Re: Issue with asset pipeline helper with Rails 3.1 final release.
I''ve finally fixed the problem I had, it was a relatively subtle point that I found in the guide. For a staging environment you have to set this config variable: config.assets.digest = true for the helpers to use fingerprinting. This is because Rails only set this to true for the production environment by default. This behavior was different in RC5 and previous release. Also, I updated bundler to the latest version, replaced the custom deploy task by adding `load ''deploy/assets''` to my Capfile and made sure to make a symlink to the shared database.yml file before the `deploy:assets:precompile` capistrano task. On Wed, Aug 31, 2011 at 5:30 PM, Nicolas Buduroi <nbuduroi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, I''ve just updated my app to the final 3.1 release and deployed it to > the staging server after running tests but there is a problem with the > precompiled assets. The precompiled assets are all in the public directory, > like they were before, Capistrano doesn''t throw any error and running `rake > assets:precompile` in the current directory work as expected. But the asset > pipeline helpers (javascript_include_tag and stylesheet_link_tag) act like > if the assets weren''t precompiled. This application have been developed from > scratch for 3.1 and deployement worked flawlessly using the release > candidates (last used was rc5), I''ve downgraded to our last Gemfile.lock and > everything work. So, has something changed since rc5 or is this a bug. > > Also, when trying the run `rake assets:precompile` on my local machine I > get this very strange error message: "Access denied for user ''root''@''localhost'' > (using password: YES)". Running rake with `--trace` doesn''t give me any more > information. I find this error non-sensical, as nothing in this project is > owned by the root user. Again downgrading to rc5 make everything work as > normal. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/PySXZDLSDdMJ. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Seemingly Similar Threads
- 3.1 asset pipeline + Capistrano troubles
- Deployment issue with Rails 3.1.1
- Learning Ruby on Rails 3.1 - deployment - Error (cs.jpg isn't precompiled)
- Linking failure in stylesheet_link_tag in production mode with asset pipeline enabled
- Rails asset precompilation doesn't remove comments. How to enable?