I am an object created through user models try to add a new property.
A = User.find (7) I am getting:
# & lt; User id: 7, Name: "Eva", email: "Stugnuz@yahoo.it", password_salt: "t4vPG0hgQVQMyIFeri6", persistence_token: "98f0cdfcb9462f3f74b1ae6ef48f0d72a015c6e04adda95fcd0 ...", login_count: 387, unsuccessful _l Login_mount: 0, current_ login_t: " 2011-03-15 08:03:54 ", Antim_ Login_t:" 2011 -03-14 23:17:45 ", current_login_ip:" 93.34.49.190 ", last_login_ip:" 93.34.38.47 ", score: 2726, level: 7, created_at: "2010-10-13 22:33:21", updated_at: "2011-03-28 13:28:40", the administrator is true, avatar_file_name: "11.jpg", avatar_file_size: 78,456, avatar_content_type : "image / jpeg", perishable_token: "PXTFtiMBxcoH3Iv7TmRh", score_this_week: 0, get_news: true, Get_notices: true, bio: "the Persian per Strada onore di Ken little Minnie anche ...", invitation_id: zero , Can_approve: false, No_score: false, facebook_uid: "1052260327", face Book_session_key: "", crypted_password: "05e5080268598607f5d1ece82db1b4d4c6ae12deeb880896ad2 ...", oauth2_token: "141832835841718 | 545eae41205d7a2ccb37d7c0-1052260327 ...", number of votes: 208, Post_ to_ Facebook the truth is, Tutoriyl_step: 2 Private: wrong number of positions: 31, equal votes: 105, Vot_this_vikik: 0, Tippniya_kod: 367, ignore wrong & gt; I want to add .votes_cast property "a" variable:
a.votes_cast = 5 But when I try to do this I get:
NoMethodError: undefined method `# & lt votes_casted = '; User: 0x102c997f0 & gt; What am I doing wrong?
Thank you, Augusta
This is to be the constant asset in your database, So you should define a migration to add a column.
If this is just a temporary area in the user model then you can simply add class user to one for app / model / user.rb Accessor class user & lt; ActiveRecord :: Base attr_accessor: Vote_cast and
Comments
Post a Comment