How to redirect to an AS view from a custom action

6 views
Skip to first unread message

Dennis Bulgatz

unread,
Mar 23, 2023, 12:20:39 PM3/23/23
to ActiveScaffold : Ruby on Rails Gem
Hi Sergio,

I have a custom controller action to clone a record. And have an action link on the records to initiate the clone.

Cloning works fine.. but I don't need a view template for this action.

The action will be taken from the list view.

What is the redirect/render command I need so I need in the "clone" controller method to either
  1. re-render / refresh the list view to include the cloned item
  2. Show the cloned item with the AS show action
  3. Edit the cloned item with the AS edit action
conf.action_links.add :clone_record, :type => :member, :method => :post, security_method: :create_authorized?,  :confirm => "Clone Record"

def clone_record
    record = SomeModel.find(params[:id])
    cloned_record = record.clone_me

    flash[:info] = as_("Record Cloned ...#{cloned_record.id}")
    list
  end

Thanks!

Dennis Bulgatz

unread,
Mar 24, 2023, 2:20:55 AM3/24/23
to ActiveScaffold : Ruby on Rails Gem
Please ignore the issue.  I need to use inline: false in the action link properties so I could redirect.  By default, inline is true, and this prevents any redirect.
Reply all
Reply to author
Forward
0 new messages