Hi, El 22/08/13 22:35, Parker Morse escribió: > On Thu, Aug 22, 2013 at 8:02 AM, Ignacio Huerta <[email protected] > <mailto:[email protected]>> wrote: > > As Kevin said, you need some Ajax, Hobo style or not. > > Take a look at this tutorial, I think it's pretty close to your needs: > http://www.hobocentral.net/tutorials/dynamic_ajax_select_menus > > > You're right, that's pretty close to exactly what I need. I'm using 1.3 > (long story) so I went back to the source recipe: > http://cookbook.hobocentral.net/tutorials/33-ajax-filtering-on-a-partially-completed > . This seems to be *most* of the way to what I need. Thanks!
You are welcome ;) > > I'm running into a problem with the controller actions, though. This > winds up being run in the context of a polymorphic_actions_for setup > (:page, in our case - the name collision with the Page model is actually > why we haven't updated to 2.0 yet). When I add this action to the > controller: > > def new > hobo_create(AnimationPane.create(params[:animation_pane])) do > hobo_ajax_response if request.xhr? > end > end > > ...the AnimationPanes created don't have the association with the parent > Page. My intuition is that I actually need to be editing new_for_page > (?) but I don't actually understand the built-in controller actions well > enough to know how that changes the code inside the action. (I also feel > like the resistance I'm feeling in trying to do this is a clue that > there's an easier way to do it.) Sometimes using the default hobo actions like hobo_create is just not appropiate. In this case, I see you are creating a record in the "new" action, the common use would be to do that in the "create" action. But I suppose you are doing that for a reason :) I don't know why it's not working, but I would start debugging by using a simple Rails action: def new logger.info params.inspect @animation_pane = AnimationPane.new(params[:animation_pane]) logger.info @animation_pane.inspect @animation_pane.save! hobo_ajax_response if request.xhr? end I suspect that your action is not receiving the "page_id" parameter that should create the relationship. The log should show you more information. Regards, Ignacio PS: Quick trick: even better than using "logger.info" you can install a couple of gems and then use "raise" to start a very nice web debugger: gem "better_errors" gem "binding_of_caller" > > pjm > > -- > You received this message because you are subscribed to the Google > Groups "Hobo Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/hobousers. > For more options, visit https://groups.google.com/groups/opt_out. -- Ignacio Huerta Arteche http://www.ihuerta.net Teléfono: 0034 645 70 77 35 Email realizado con software libre -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/hobousers. For more options, visit https://groups.google.com/groups/opt_out.
