Displaying Read-Only Attribute #175
firewalker06
started this conversation in
General
Replies: 2 comments
|
Or a |
0 replies
|
We could probably check for class Post < ActiveRecord::Base
attr_readonly :title
end
post = Post.create!(title: "Introducing Ruby on Rails!")
post.update(title: "a different title") # change to title will be ignoredhttps://api.rubyonrails.org/classes/ActiveRecord/ReadonlyAttributes/ClassMethods.html |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Since madmin works by iterating through
model.attributes, I was thinking usingActiveModel::Attributes::ClassMethods#attributewould work if we want to have a Read-Only attribute in madmin. Turns out its true:But I think it would be good idea to have
read_attributethat displays in Index and Show view.All reactions