I am eager to try out DataMapper for a new Rails project. I created my project using the following command:
rails new project_name -m http://datamapper.org/templates/rails.rb
I decided to test out my application by running:
rails server
When I go to the generic home page that is created, I can’t see any images. I get an error stating:
ActionController::RoutingError (No route matches [GET] "/assets/rails.png")
If I create any other scaffolds and visit those pages, I get similar errors about the stylesheets or javascript not found. I double checked to ensure that a regular Activerecord-rails application worked (which it did). I’m rather puzzled. Any help would be greatly appreciated. Thank you 🙂
For some reason, DataMapper’s Rails template completely replaces the standard
Gemfilewith their own, which doesn’t include any of the asset handling stuff (it also removes a handful of other things like jQuery support, TestUnit, ActionMailer…).You’ll want to add these back in to your
Gemfileafter setting up the new application:Per Frederick’s suggestion below, you’ll also want to add this into your
config/application.rbfile:I opened an Issue and submitted a pull request to fix this.
Update: As of 1/5/2012, this is now fixed. The template behaves nearly identical to a standard Rails 3.1 app with the only change being ActiveRecord being replaced with DataMapper. Assets/jQuery support now works.