Hi Sergio,
How can I override redirect after create action?
Seems like there should be an easy way to specify in controller.
User desire: after a record gets created, redirect to the list view, with
a search param so they can easily see the record that was just created.
This does not work because the redirect is not to a page.
def tdn_params
params.require(:record).permit(
:title,
:ordinal,
:revision_description,
:is_latest
)
end # def tdn_from_params
def create
tdn = Tdn.new(tdn_params)
tdn.discipline_id = params[:record][:discipline]
tdn.clin_id = params[:record][:clin]
tdn.task_id = params[:record][:task]
tdn.organization_id = params[:record][:organization]
if tdn.save
redirect_to tdns_path({'search[tdn_number][opt]': '=',
'search[tdn_number][from]': tdn.tdn_number})
#redirect_to edit_tdn_path(@tdn)
else
flash[:error] = "Could not Create TDN. Latest Rev??"
redirect_to tdns_path
end
end
Thanks
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/activescaffold/ac644e5b-5f88-4883-bcdd-1f25495fab58n%40googlegroups.com.