Im a newbie to rails and im trying to set my app up on my host provider. However i have run into a problem. My webhost setup is passenger, rails 3.2.2 and ruby 1.8.7. Im having the following issue
ActionView::Template::Error (formtastic.css isn't precompiled):
5: <title> <%=h @club.title %> </title>
6: <% end %>
7:
8: <%= stylesheet_link_tag "application", 'formtastic.css','my_formtastic_changes' %>
9: <%= javascript_include_tag "application" %>
10: <%= csrf_meta_tags %>
11:
app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___1734619706_23763401823460'
app/controllers/news_controller.rb:11:in `index'
I have precompiled my app using following command
RAILS_ENV=production bundle exec rake assets:precompile
No joy.
I have tried adding it to my production.rb
config.assets.precompile += %w( formtastic.css )
No joy.
My application.css looks like so
/*
*= require_self
*= require_tree .
*= require formtastic
*= require my_formtastic_changes
*/
Ive tried with the above and also without the above etc etc
My manifest looks like so
cat manifest.yml
formtastic.css: formtastic-1c695b81053b6c3b5375b0ceea61290c.css <br>
rails.png: rails-be8732dac73d845ac5b142c8fb5f9fb0.png<br>
application.css: application-58c08b7046a2045ea1395b196ce3607a.css<br>
application.js: application-d1fbc53f1635b41e40f5ebb9a3b000ee.js<br>
Ive run into a dead end with trying to get this to work and it is probably something very simple.
Anyone got any ideas? Ive read already a few posts on this but none seem to work for me.
From the Formtastic README in the section about stylesheet usage in rails > 3.1, it looks like the only thing you need to do is add *= require formtastic
in your application.css-- you don't need to reference formtastic.css
in your stylesheet_link_tag
or in your config.assets.precompile
. It's likely going to be the same thing with your my_formtastic_changes
stylesheet, so the only thing in the stylesheet_link_tag
would be 'application'
.
As a side note, both the versions of Ruby and Rails that you're using are old. In particular, Rails 3.2.2 has some security vulnerabilities that were fixed in later versions (here's one example). The most current released version of Rails as of today is 3.2.14, and I would recommend either Ruby 1.9.3 or 2.0.0. I realize this might be your host's decision and not yours, and you'd likely be fine with a hobby project, but I would be negligent if I didn't warn you against making a critical production application with these versions.