You are asigning foo to the name field... and nothing to the data field... in your model, you declared data as a requires field... if you don't assign anything to it, it's nil... and data must have a value... that's why.
Hi *, I have a model like this:class Traitinclude DataMapper::Resourceproperty :id, Serialproperty :name, Slug, :required => trueproperty :data, Decimal, :required => truehas n, :items, :through => :assignmentshas n, :assignmentsendand if I do:irb(main):029:0> t = Trait.new=> #<Trait @id=nil @name=nil @data=nil>irb(main):030:0> t.data = 1.0=> 1.0irb(main):031:0> t=> #<Trait @id=nil @name=nil @data=nil>irb(main):032:0> t.name = "FOO"=> "FOO"irb(main):033:0> t=> #<Trait @id=nil @name="foo" @data=nil>irb(main):034:0> t.save=> falseirb(main):035:0> t.errors.inspect=> "#<DataMapper::Validations::ValidationErrors:0x00000005bb5e40 @resource=#<Trait @id=nil @name=\"foo\" @data=nil>, @errors={:data=>[\"Data must not be blank\"]}>"can someone explain me why I'm not able to set the data attribute?TIA,ngw--
You received this message because you are subscribed to the Google Groups "DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datamapper+...@googlegroups.com.
To post to this group, send email to datam...@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
I see him setting data to 10 - did you miss that? I'm not where I can try this, but I'd rename data and see if that helps. DM has internal methods, perhaps you have a a collision?