0

I am struggling to add param at the end of every route in active admin any idea how it can be done??

For example /admin/edge?journey=1

i want journey param to be appended to all actions urls

Any help or suggestion would be greatly appreciated

1 Answers1

0
class ApplicationController < ActionController::Base

  before_action if: :active_admin_controller? do
    params[:journey] = 1
  end

  private
  def active_admin_controller?
    self.is_a?(ActiveAdmin::BaseController)
  end
end
plusor
  • 69
  • 6
  • is it possible to do it in active admin only because param is only available on active admin page – ronaksharma Sep 07 '21 at 06:01
  • ActiveAdmin::BaseController replace with ActiveAdmin::PageController – plusor Sep 07 '21 at 06:04
  • i did not get what should i do in active admin page to add param for every url?? should i override the resource_path method i am new to active admin so not sure – ronaksharma Sep 07 '21 at 06:11
  • 1
    Thank you for contributing an answer. Would you kindly edit your answer to to include an explanation of your code? That will help future readers better understand what is going on, and especially those members of the community who are new to the language and struggling to understand the concepts. Thanks. – Jeremy Caney Sep 08 '21 at 02:40