On Jueves, 13 de Mayo de 2010 17:27:08 Iñaki Baz Castillo escribió: > 2010/5/13 Iñaki Baz Castillo <[email protected]>: > > 2010/5/13 Iñaki Baz Castillo <[email protected]>: > >> This last solution fails as I think it's trying to use @record which > >> is empty in this case (I'm not handling a member in the controller): > > > > But I can fix it by maunally setting @record in the action methd :) > > However I don't like it. By inspecting "rake routes" I see: > > empty_dst_black_lists GET /dst_black_lists/empty(.:format) > {:controller=>"dst_black_lists", :action=>"empty"} > > But it should be (note the :id): > > empty_dst_black_lists GET /dst_black_lists/:id/empty(.:format) > {:controller=>"dst_black_lists", :action=>"empty"} > > I get it by setting the following rule: > > map.resources :dst_black_lists, :active_scaffold => true, > > :collection => {:regex_reload => :get}, :member => {:empty => :get} > > In this way I "expect" that Rails itself (RESTful) would autogenerate > the @record instance based on .id parameter, am I right? Unfortunately > it doesn't work, I still have to set @record based on the params[:id]. > Sure I miss something :(
No, rails never get a record automatically. You have to call Model.find with params[:id] and store in a instance variable, which can be named as you want. @record is an ActiveScaffold convention. -- Sergio Cambra .:: entreCables S.L. ::. Mariana Pineda 23, 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [email protected] -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.
