我有这个控制器
def mymethod
@theparam => (params[:valueoftheparam])
@theparam => "3"
callothermethodthatusetheparam
end
Run Code Online (Sandbox Code Playgroud)
所以基本上,我有"valueoftheparam"这是"2".
我需要将"2"的值更改为"3",然后让"callothermethodthatusetheparam"新的参数(即"3"),
但最后"callothermethodthatusetheparam"仍使用旧值("2").
如何在控制器中更改此值,并让"callothermethodthatusetheparam"使用新的参数值?
谢谢!
我已经阅读了一些关于向现有表添加列的教程.我想到了一个问题,是否可以在现有表中添加额外的行
例,
我有一张汽车表,其属性为:type和:color,我有一个方法
def mymethod_todoinsertnewrowsincartable
insert car {:type =>"BMW",:color =>"blue"}
end
我怎么能用上面的方法呢?谢谢
我有一个基本的问题,我无法从ruby中理解.如果在活跃的记录中,我有"@food",它与"食物"有什么不同.我认为它是一个数组,但不是主动记录可以假定为数据列表(数组?)
谢谢你的分享