responds_to_parent do
render :update do |page|
page << "tb_remove"
item_link = params[:controller].eql?("compliance_items") ? edit_compliance_compliance_item_path(master, @master_item) : edit_controls_item_path(@master_item)
# page.redirect_to(item_link + "?token=#{params[:token]}")
end
end
Hi in the above code I am gettign double render error(subject line is the error )... can anybody please help?
it is also vary bad to - stack over flow is not giving any option to create a new tag without reputation..!!!
You cannot call both render
and redirect_to
. That is what you have done (calling redirect_to
inside the render
block.
To redirect in some cases, you will need to move the if
condition outside the render
block. Try something like this:
if I_need_to_redirect
item_link = params[:controller].eql?("compliance_items") ? edit_compliance_compliance_item_path(master, @master_item) : edit_controls_item_path(@master_item)
redirect_to item_link
else
responds_to_parent do
render :update do |page|
page << "tb_remove"
end
end
end
Where I_need_to_redirect
should be replaced with the condition for checking whether you should redirect (if false, it should render instead).