Search code examples
rubyruby-on-rails-3formtasticactiveadmin

Rails 3- Active_admin - Show field in the new page but not in the edit


I have a model called user. I want to show the password field just on the create page, not the edit one.

ActiveAdmin.register User do
    form do |f|
       f.inputs "User Details" do
          f.input :first_name
          f.input :last_name
          f.input :email
          if f.object.new_record?
              f.input :password
          end

       end
    f.buttons
    end
 end

This is what I tried but using .new_record? function all my fields disappear from the edit page.

Any ideas?


Solution

  • The solution was to use a partial.