hcatlin/make_resourceful — Issue #12: new/create not working with singleton controller
Author: JRod
Created: 2012-01-01 15:37:24+00:00
State: open

Given following structure:

class Person
has_one :hat

class Hat
belongs_to :person

In the HatsConrtoller, i had to overwrite current_object because the route /persons/1/hat was not working (error was: "No object given")

def current_object
current_object ||= Person.find(params[:person_id]).hat
end

Then when I call /persons/1/hat/new , I got the error:
"undefined method `hats' for Person"

Stack is:
/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb:173:in `send'
/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb:173:in `current_model'
/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb:125:in `build_object'
/vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb:74:in `new'