Search code examples
ruby-on-rails-6rails-admin

Using custom JQuery in Rails Admin [rails 6]


My application uses 'rails_admin' and I would like every page within '/admin' to have a custom javascript file.

rails version: 6

EDIT:

My example I want to remove all these comments on each model, when I go to 'add new'.

All of these are <span class = 'help-block'>...</span> so I thought about using document.getElementsByClassName("help-block").style.visibility = "hidden"; it to solve my problem.

But it did not work.


Solution

  • Rails admin has a way to remove those "comments" for example if you place this code any of your models

    rails_admin do
      edit do
        field :name do
          help do
            nil
          end
        end
      end
    end
    

    Its kind of annoying to do it for every field, but repetition in configuration is one of rails_admin weaknesses