ruby-on-railsrubyrails-admin

rails_admin: id field clickable and redirect to the show


I am using rails_admin gem for my rails project

I need to make the id column clickable, so when I click on the object's id I can be redirected to the show action

enter image description here


Solution

  • Someone answered my issue on Github , here is the link

    it can be done like that

    config.model Booking do
        list do
          field :id do
            formatted_value do
              path = bindings[:view].show_path(model_name: 'Booking', id: bindings[:object].id)
              bindings[:view].link_to(bindings[:object].id, path)
            end
          end
      ....