1
votes

Hi i have an admin page using active admin gem. thing is while creating a new page i should be able to input name, amount and interval..But while updating only name field must show..other 2 values shouldnt be updated. This is my active admin file. How to make this happen. Thanks in advance

ActiveAdmin.register SubscriptionPlan do
  menu  priority: 10
  permit_params :name, :amount, :interval

  index do
    selectable_column
    default_actions
    column :name
    column :amount
    column :interval
  end

  form do |f|
    f.inputs "Subscription Plan" do
      f.input :name
      f.input :amount
      f.input :interval, as: :select, collection:["week","month","year"]
    end
    f.actions
  end
end
1
its realy nice to see people downvoting when they dont know the solution - Nidhin S G

1 Answers

3
votes

Try this

form do |f|
  f.inputs "Subscription Plan" do
    f.input :name
    if f.object.new_record?
      f.input :amount
      f.input :interval, as: :select, collection:["week","month","year"]
    end
  end
  f.actions
end