#33 ✓resolved
Rein Henrichs

#reload and #reload! b0rked

Reported by Rein Henrichs | October 27th, 2007 @ 02:27 PM

>> Project.first.reload!
D, [2007-10-27T14:26:10.418249 #4038] DEBUG -- : SELECT `id`, `title`, `description`, `account_id` FROM `projects` LIMIT 1
NoMethodError: undefined method `mappings' for #<DataMapper::Context:0x2534a9c>
        from /opt/local/lib/ruby/gems/1.8/gems/datamapper-0.2.0/lib/data_mapper/support/active_record_impersonation.rb:15:in `reload!'
        from /opt/local/lib/ruby/gems/1.8/gems/datamapper-0.2.0/lib/data_mapper/support/active_record_impersonation.rb:19:in `reload'
        from (irb):32
        from :0

same for #reload

Comments and changes to this ticket

  • Sam Smoot

    Sam Smoot October 27th, 2007 @ 04:34 PM

    • State changed from “new” to “open”

    DataMapper::Context used to expose the mapped DataMapper::Adapters::Sql::Mappings::Schema through a #mappings method. You can index the Schema for a particular Table.

    I replaced that with DataMapper::Context#table because it's one less method-call in the call stack, and it's better at revealing intent.

    So that's the why.

    The how is that #reload! was apparently never specced, so it slipped through the cracks. I'll work on that now...

  • Sam Smoot

    Sam Smoot October 27th, 2007 @ 04:38 PM


     it "should destructively reload the loaded attributes of an object" do
       zoo = Zoo.first(:name => 'Dallas')
       zoo.name.should eql('Dallas')
       zoo.name = 'bob'
       zoo.name.should eql('bob')
       zoo.name.should eql('Dallas')
  • Sam Smoot

    Sam Smoot October 27th, 2007 @ 04:41 PM

    • State changed from “open” to “resolved”


Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket


Referenced by