On Dec 8, 2010, at 6:40 PM, Tuishimi wrote: > I am probably using custom actions incorrectly. I want to have > several different versions of "show" action where the sub-data is > gathered with some specific parameters (effectively filtering the > data). > > So basically I might have on a page: > > XXX Errors: 43 -> which links to a show action of xxxerrors > ZZZ Errors: 8 -> which links to a show action of zzzerrors > > These methods are called, the error data is loaded but then when it > routes to show the page it overrides my error collection and uses the > default query for show (I can see it requery in the log)! I don't > want it to do that. Is there a better approach? I am doing this > through a parent class page and the show method is for said parent > that "has_many" errors. > > Here is an example of a method in the controller (ThisClassController, > let's call it): > > show_action :xxxerrors do > @this_class = ThisClass.find(params[:id]) > sql = "blah blah blah" > @error_logs = ErrorLog.find_by_sql(sql) > end >
I'm not 100% sure what's happening here - show_action adds the name it's passed to the router's tables, then defines a method using the passed block. The only way you get the default hobo_show action is if the block is omitted entirely: hobo_show :some_action_name --Matt Jones -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en.
