Skip to content

Associate name doesn't display when read_only set to true #2681

@mjfaga

Description

@mjfaga

I'm trying to display an association attribute to read only to ensure it can't be edited while my model is in edit mode.

My models for User and Account are defined as show here:

class User < ActiveRecord::Base
  belongs_to :account, class_name: "Account"
  ...
end

class Account < ActiveRecord::Base
  has_many :users
  ...
end

Below is the code I have in place in my rails_admin.rb initializer, where the :account is the association on my User model:

config.model User do
  configure :account do
    read_only true
  end
end

When read_only false is configued, things look as I would expect in edit mode of the User:
screen shot 2016-08-03 at 10 09 37 pm

However, when read_only true is turned on as show in the above code snippet, I get the following while in edit mode of the User:
screen shot 2016-08-03 at 10 10 07 pm

Any help is appreciated. Currently running Rails 4.2.5.1, Ruby 2.3.1, Rails Admin 0.8.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions