You are posting to /person instead /people. form_for(@person) is generating the form action to '/person' for some reason - a bug perhaps(?). In the form, make sure to add :action => resource(:people) (i.e. `form_for(@person, :action => '/people') do...`).
The fact that you are getting a NoMethodError is a different bug though. Merb should be raising a NotFound, which among other things would make cases like yours easier to debug. I submitted a patch to fix this (https://merb.lighthouseapp.com/projects/7435/tickets/34-unexpected-behavior-using-default_routes#ticket-34-3) but no one ever took care of it ;) On Thu, May 27, 2010 at 8:33 PM, sso <[email protected]> wrote: > I'm getting this error whenever I post to the scaffold generated > "create" method. > > View: > <h1>People controller, new action</h1> > <%= form_for @person do %> > <%= text_field :name, :label => "Name:" %> > <%= submit "Submit Me" %> > <% end =%> > > Controller: > ...... > def new > only_provides :html > �...@person = Person.new > display @person > end > > def create(person) > �...@person = Person.new(person) > if @person.save > redirect resource(@person), :message => {:notice => "Person was > successfully created"} > else > message[:error] = "Person failed to be created" > render :new > end > end > .... > > Model: > class Person > include DataMapper::Resource > > property :id, Serial > property :name, String > > > end > > -- > You received this message because you are subscribed to the Google Groups > "merb" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/merb?hl=en. > > -- -jonah -- You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/merb?hl=en.
