Questions tagged [datamapper-1.2]

7 questions
2
votes
2 answers

Can DataMapper `Decimal` properties to automatically round to the correct scale?

Suppose I have the following DataMapper model: class Payment include DataMapper::Resource property :id, Serial property :amount, Decimal, precision: 8, scale: 2 end Then I do the following: p = Payment.new(:amount => 12.3245) This payment…
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
1
vote
1 answer

stack overflow in datamapper from has n relationship

In my Profile class the has n association with :fields is problematic. If it's there and I run the following: user = User.create user.profiles << Profiles.new user.save Profile.all The following exception is thrown: SystemStackError: stack level…
Jon
  • 462
  • 4
  • 13
1
vote
2 answers

How can I list DataMapper errors that aren't tied to one property?

DataMapper models allow custom validations of two forms: those specific to a property, and overall object validations. For example: # Validates the `name` property with the `check_name` method; # any errors will be under `object.errors[:name]` …
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
0
votes
0 answers

How to create an OPTIONAL many-to-many association in data_mapper?

I'm sorry, I can't ask the question better. I want to be able to create a Station and save it into the db, without having to know about the route yet. How do I have to change my models? class Station include DataMapper::Resource property :id, …
le_me
  • 3,089
  • 3
  • 26
  • 28
0
votes
1 answer

How to reload instances using DataMapper

I'm using DataMapper as ORM framework after many years of experience with AR. For that reason I sometimes try to find a specific DM function that mirrors some behaviour from AR. Sometimes I'm lucky, sometimes I'm not. With the #reload directive, I'm…
ChuckE
  • 5,610
  • 4
  • 31
  • 59
0
votes
1 answer

errors with the name of the table in Datamapper ( city )

I've a model called City in datamapper for codeigniter. I've kept the name of the table as "cities" because datamapper expects the name of the table in pluralized form. Now when I create the object for the model in controller ( $c = new City(); ); I…
Shashi Roy
  • 323
  • 3
  • 7
  • 22
0
votes
2 answers

Undefined method opts_from_validator_args

I just tried updating a project to use DataMapper 1.2 (from 1.1) and now I'm getting this error: /home/joe/.rvm/gems/ruby-1.9.2-p290@marketplace-admin/gems/dm-core-1.2.0/lib/dm-core/model/relationship.rb:372:in `method_missing': undefined method…
mltsy
  • 6,598
  • 3
  • 38
  • 51