George,

Here's a link where I tried to collect information on when to use
self. with datamapper (of course, this is all due to how ruby works,
nothing special with datamapper)

http://alfred.datamapper.org/posts/21

cheers
snusnu

On Tue, Nov 3, 2009 at 11:36, Dan Kubb (dkubb) <dan.k...@gmail.com> wrote:
>
> George,
>
>> The following code does not seem to work. After creating a new object
>> the active_trip_id field is blank in the database. Any ideas what I'm
>> doing wrong?
>
> ...
>
>>     # Default activeTrip to itself if none specified:
>>     before :save do
>>       activeTrip ||= self
>>     end
>
> The first thing I'd try is prefix the assignment with self, eg:
> self.activeTrip ||= self
>
> Without that you're assigning to a local variable, not the object
> accessor/mutator.
>
> --
>
> Dan
> (dkubb)
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to