ok, that kinda works. well, at least it makes sense. But I still don't see how to get the functionality I'm looking for.
Firstly, that is a static redirect to a single menu. I have several menus, and within each you can add items, so it'd be nice for it to redirect to whichever menu I'm currently adding items to. Secondly, the items_for_menu_path directs me to a a page with the items listed for that menu, not the menu page I was already on with the nifty display achieved through auto_actions_for :menu So those are my problems with this solution. Any more help would be greatly appreciated. I'm still trying to figure out how this all works! hoboHippy On Oct 14, 8:57 pm, Bryan Larsen <[email protected]> wrote: > try :redirect=> items_for_menu_path(:menu_id => zzz) > > where zzz is the menu_id. > > Bryan > > > > > > > > On Fri, Oct 14, 2011 at 7:07 PM, hobo_hippy <[email protected]> wrote: > > rake routes is quite nifty, didn't know about before! > > > so from rake routes I found what I think I'm looking for : > > > items_for_menu GET /menus/:menu_id/items(.:format) > > {:action=>"index_for_menu", :controller=>"items"} > > > so in my items controller i have: > > > class ItemsController < ApplicationController > > > hobo_model_controller > > > auto_actions :all, :except => [:index] > > auto_actions_for :menu, [:index, :create] > > > def create > > hobo_create :redirect=> :items_for_menu > > end > > > end > > > which i thought wouldredirectto me back to the current menu page > > after creating an item from the menu page. This is not happening. I'm > > still getting directed to the item show page... > > > whats wrong here? > > > On Oct 14, 5:26 pm, Bryan Larsen <[email protected]> wrote: > >> Yes it's in the manual further down the > >> page:http://cookbook.hobocentral.net/manual/controllers#automatic_redirection > > >> I've just expanded part of that chapter. > > >> The `:redirect` option may be one of: > > >> - Symbol: redirects to that action using the current controller and > >> model. If you have `show_action :detail` in your > >> controller, then you could use `:redirect=> :detail`. > >> - Hash or String: [redirect\_to from > >> Rails](http://api.rubyonrails.org/classes/ActionController/Redirecting.html) > >> is used. Examples: `:redirect=> {:controller => "sites", :action > >> => :admin, :id => this.site}` and `:redirect=> site > >> s_admin_path(this.site)`. `rake routes` lists available paths that > >> can be used. > >> - Array: `object_url` is used. > > >> I've never used the array form. Does anybody have an example? > > >> Bryan > > >> On Fri, Oct 14, 2011 at 4:33 PM, hobo_hippy <[email protected]> wrote: > >> > In the hobo manual under Controllers, Automatic Redirection, > >> > the :redirectparameter, an example is given as follows, > > >> > def update > >> > hobo_update :redirect=> my_special_place > >> > end > > >> > I want to use something like this, but what is my_special_place? How > >> > do I define my own special place? Is there a way to just tell it to > >> > reload the same page? Or go to the last page visited? > > >> > If there's documentation on how this works, I'd appreciate a link. Any > >> > explanation would also be greatly appreciated. > > >> > Thanks! > > >> > -- > >> > 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 > >> > athttp://groups.google.com/group/hobousers?hl=en. > > > -- > > 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 > > athttp://groups.google.com/group/hobousers?hl=en. -- 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.
