ruby - vulnerabilities - jquery cve




In rails_admin, how do I turn off the “add new” and “edit” button in relation sub-foms? (3)

I want to stop people adding or editing Page Layout from inside a sub form. Basically I want to turn off the buttons in the below screenshot:

Am I able to do this, or do I have to turn off adding and editing on the entire Page Layout model globally?


Maybe not the cleanest solution... anyway here's what i did. Created an alternative partial copying the original one and stripping off the links related to "add new" and "edit". Then I configured the field like this.

  field :operator_user do
    partial "form_filtering_select_no-relations"
    def selected_id
      @bindings[:object]['operator_user_id']
    end
  end

The partial expects a method called "selected_id" to be there and return the id used to build the relation.


Probably a bit late but you can use inline_add and inline_edit.

Example:

  field :profile do
    inline_add false
    inline_edit false
  end

Use button_to with :disabled => true option





rails-admin