Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Rails 3 problem with files in public folder
3 Posts
Rails 3 problem with files in public folder

Posted this on railsforum.com, with not much luck. I'm in the process of converting a rails 2.3.5 app to rails 3. All the routes work correctly, I can use the program just fine. However, my local stylesheets, javascript files and images that sit under the public/* folder are not rendering. The html attributes have the correct paths and so forth. When I browse to one of the stylesheets for instance, I get a No route matches "/stylesheets/styles.css". The permissions on the public folder look fine. I've used the rails upgrade gem as discussed: http://omgbloglol.com/post/359147788/rails-upgrade-automating-a-portion-of-the-rails-3, and the only thing i need to fix is some of my action mailer code.

I've cross referenced various files under the config directory with a fully working rails 3 application that I have. Double checked the script directory, which only contains the rails script. I am really running out of ideas here. Any ideas would be greatly appreciated.

Can you show how you are referencing the style sheets?

To get to the stylesheets directory, you only need to do:

Which will render the file: Rails.root / public/stylesheets/mysheet.css

Mikel Lindsaar

I had fixed it a little bit ago. It was actually some older rails 2.3 code in my development.rb that was causing the issue. I copied over the code in my other rails 3 project and it worked.

3 Posts
Login to add your message