0
我有这样一个模型:参数没有名称型号
class Attribute < ActiveRecord::Base
attr_accessible :name
end
和参数后的行动:
name='foo' (not attribute[name])
在创建行动,我可以创建属性是这样的:
attribute=Attribute.new(:name => params[:name])
如何告诉rails解析模型属性等每个参数?
attribute=Attribute.new(params[:attribute])