Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add new item inside show table active admin in rails

how to add new item inside show table active admin in rails ?

i try this code :

show do |ad|
    default_main_content
    attributes_table do
      row "States : "
      row ad.states.map(&:name)
    end
  end

but the "States" not add inside table?

like image 405
tardjo Avatar asked Dec 08 '25 03:12

tardjo


2 Answers

If you don't want to lose default attributes (database columns) just do:

show do
  attributes_table(*default_attribute_table_rows) do
    row "My new row description" do
      My row value
    end
  end
end

Your new row will be displayed at the bottom of the table

like image 137
pomodroizer Avatar answered Dec 11 '25 01:12

pomodroizer


this is my code :

show do |ad|
    attributes_table do
      row :id 
      row :name
      row :featured
      row :url
      row :amount
      row :application_deadline
      row :accreditation
      row :created_at
      row :updated_at
      row :degree_type
      row :states_name do 
        ad.states.map(&:name)
      end
      row :description
      row :slug
      row :deadline
      row :degree_string
      row :image_file_name
      row :image_content_type
      row :image_file_size
      row :image_updated_at
      row :real_amount
      row :real_deadline
    end
  end
like image 26
tardjo Avatar answered Dec 11 '25 01:12

tardjo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!