ruby on rails - Passing instance variables or query strings around in ActiveAdmin -


in activeadmin project have categories , products. each product has category. able save product associated category perfectly. need ability add product , it's category give user ability save normal or save , add product same category. thinking pass category in query string getting double redirect when tried override create method. idea how done?

this tried again caused redirect error:

    def create       @items_design = itemsdesign.new(params[:items_design])       create! |format|         format.html { redirect_to  "http://test.******.com:3000/admin/products/1873" }       end       super     end 

reason getting double redirect because when create itemsdesign record have redirect call without return. next code gets executed call super there again redirectcall causing error.

you can resolve double redirect error adding and return redirect_to call below:

    def create       @items_design = itemsdesign.new(params[:items_design])       create! |format|         format.html { redirect_to  "http://test.******.com:3000/admin/products/1873" , return }       end       super     end 

if passing category_id(replace appropriate key) query_string can access in create action params[:category_id] , use accordingly.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -