ruby on rails - Property from attr_accessor does not show when I render json -
in rails, have user model. added attr_accessor :score
to model.
if render json 1 user, not see "score" attribute. why this?
user = user.find(3) user.score = 55 render json: user
render json: user, methods: [:score]
attr_accessor alternative getter , setter method method , have mentioned can call above
Comments
Post a Comment