ruby on rails - Property from attr_accessor does not show when I render json -


in rails, have user model. added attr_accessor :scoreto 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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -