Search code examples
ruby-on-railsrubygemsrails-admin

adding dropdown in rails_admin other form fields of same page is not shown


I am using devise and the rails_admin gem. I want to add drop down in the from filed role of the rails_admin dashboard. I copied some code from internet to do so, but when i add this code, only the role field comes with the drop. Other input that is filed is not shown in the rails_admin dashboard.

User.rb

  rails_admin do
    create do
      field :role , :enum do
        enum do
          [['admin','admin'],['user','user']]
        end
      end
    end
  end

Anybody knows why other users form filed is not shown in rails_Admin Dashboard after adding above code.


Solution

  • It should be edit not create, like this

     rails_admin do
        edit do
          field :role , :enum do
            enum do
              [['admin','admin'],['user','user']]
            end
          end
        end
      end