Druid Druid - 2 months ago 22
Ruby Question

rails_admin: id field clickable and redirect to the show

the question seems naive but I'm new to rails admin

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

Answer

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
  ....
Comments