dfasofjoaishoiqw4e
dfasofjoaishoiqw4e

Reputation: 77

Ruby on rails activeadmin i cant find file to change view of input forms

I cant find files where i can change inputs in activeadmin, when im making new object.

Where i can find files with view of admin panel.

Upvotes: 0

Views: 390

Answers (2)

Christsooper
Christsooper

Reputation: 36

Active Admin automatically generates forms based on your model's columns but you can edit the form if you want to. For example, if you have a user model that has columns email,name,first_name,last_name, token and so on

form do |f|
  f.inputs "New User" do
    f.input :email
    f.input :name
    f.input :first_name
    f.input :last_name
    f.input :token
  end
  f.actions
end

That code would show email, name, first_name, last_name and token as input fields for the form. In your case, just exclude the token field so that it would not be rendered in the view. You can add this lines of code in your user.rb file under the admin folder in your app folder project-name/app/admin/user.rb

This would automatically override the default form for your user model

Upvotes: 2

Swati Yamgar
Swati Yamgar

Reputation: 139

ActiveAdmin generates form by its own depending on model attributes. If you want to customize the default form you can follow the documentation: documentation

Upvotes: 0

Related Questions