Hi folks
I'm building a sinatra app with DataMapper.
One of my models is misbehaving, but I can't figure out what is wrong.
Basically when I try to create a new Mission record, it refuses to save it,
but does not give me any kind of error message to help me figure out why.
When I inspect the record/object, all the data I passed to the properties
are there, but it doesn't create an @id(=nil) or @created_at(=nil),
presumably because it will not create it :/
Any idea how I can draw out some more information?
Here's some info on the model:
class Mission
include DataMapper::Resource
property :id, Serial #auto-increment integer key
property :numero, Integer, :required => true
property :nom, String, :required => true
property :briefing, Text, :required => false, :default => "Pas de
briefing"
property :debriefing, Text, :required => false, :default => "Pas de
debriefing"
property :date_hist, DateTime,:required => false
property :created_at, DateTime
belongs_to :campagne
has n, :flights
has n, :avatars, :through => :flights
end
I use a seed script to create the record:
m1=Mission.first_or_create(:numero => 5,
:nom => 'La Belle Rouge',
:briefing => 'test',
:debriefing => 'test',
:date_hist => 1955)
here's what I get in the console when I run the seed script:
=> [#<Mission @id=nil @numero=5 @nom="La Belle Rouge" @briefing="test"
@debriefing="test" @date_hist=1942 @created_at=nil @campagne_id=3
@promotion_avatar_id=nil @promotion_grade_id=nil @reward_avatar_id=nil
@reward_decoration_id=nil>]
Is it something about the relationships that HAVE to be created first
before I can create a Mission record?
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/datamapper/-/YqFKy6fe8lEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.