app/models/admin/param.rb in aslon_settings-0.0.1 vs app/models/admin/param.rb in aslon_settings-0.0.2

- old
+ new

@@ -3,11 +3,11 @@ class Admin::Param < ActiveRecord::Base has_many :items, :class_name=>'Admin::ItemParam' accepts_nested_attributes_for :items - attr_accessible :name, :pos ,:items_attributes + attr_accessible :name, :pos ,:items_attributes ,:value def self.method_missing(method, *args) method_name = method.to_s super(method, *args) @@ -31,12 +31,13 @@ puts method_name puts args.first var_name = method_name.gsub('=', '') value = args.first - o= (eval "items.where(:name=>'#{var_name}')").first + o= items.where(:name=>var_name).first if o==nil - o= (eval "items.create(:name=>'#{var_name}')") + o=items.new + o.name= var_name end o.value = value o.save #retrieve a value else \ No newline at end of file