Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I really appreciate any respond for this simple question.
test = Model.find_by_sql("SELECT number FROM tbl_one LIMIT 1").each do |a|
    p = a('number')
    puts p
end

Look, I mean, after store a value to 'p', how do I add the 'p' value by 1.
puts p + 1

I tried it but doesn't work. Based on what I saw, the 'p' doesn't really store the value, but I don't really sure. Anyway, I'm new on Ruby and Rails

Any solution?
Thanks.
Posted

1 solution

Ups!
Sorry, my mistake.. I found it!
p = a('number').to_i

Then I can add the value by 1 easily..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900