er, small correction: I should have had
def create_for_menu hobo_create :redirect => :items_for_menu end but this just gets me an error. cannot redirect to nil... /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/ action_controller/base.rb:1104:in `redirect_to_without_object_url' ... what have i got wrong here? On Oct 14, 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 would redirect to 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 :redirect parameter, 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 at http://groups.google.com/group/hobousers?hl=en.
