Wondering and worring about veriable scope


#1

Hi,

Still yesterday my aplication was working fine. Today i got problem
in veriable scope…

Acually there is a ‘if’ condintion
Mistakenly i created one object inside and i was accessing that object
outside of that if condition.

For example,

if user
 role=Role.new
 role.name='john'
 role.save
end

After that i try to access that role

 role_id=role.id

Is it correct?

My friend also got same kind of problem recently…

Or am i doing wrong?.But today only i got problem…Thats why I got
confusion…Or any silly things i am doing??? Or any automatic update
in my server? (So ruby version may be changed…)