4

I have custom configuration for User model:

rails_admin do
  list do
    field :name
    field :email
    field :company
  end

  edit do
    field :first_name
    field :last_name
    field :email
    field :password
    field :company
  end
end

And is there a way to hide company field (which is has_many relation) when using nested form?

3 Answers 3

2
edit do
  configure :companies do
    hide
  end
end

This hides companies field from create and update while still showing it when listing

Sign up to request clarification or add additional context in comments.

Comments

1
list do
    field :name
    field :email
    field :company do
      visible do
         false
      end
    end
end

Is that what you wanted? I did somenthing like this in a project that only the admin could use a field. Instead of "false" there was something like "bindings[:view]._current_user.admin?".

Comments

0

Something like this, maybe?

list do
  ....
  configure :company do
    hide
  end
end

1 Comment

As I know this will hide company only in list view. I need hide it when I am adding new user using Company view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.