Yes, but your hook is being called on an instance unless you used
#before_class_method. If you do:
before :create, :some_method
def some_method
# ...stuff
end
#some_method is performed on the record before it is created (so a new
record), and thus 'self' refers to the record.
On Jan 17, 11:01 pm, Zhi-Qiang Lei <[email protected]> wrote:
> But create is a class method.
>
> On Jan 18, 2011, at 6:33 AM, RipTheJacker wrote:
>
>
>
>
>
> > Yes, the record is just 'self' in all hooks.
>
> > On Jan 16, 11:29 pm, Zhi-Qiang Lei <[email protected]> wrote:
> >> Dear All,
>
> >> Is there a way to access the record in after create hooks?
>
> >> Best regards,
> >> Zhi-Qiang Lei
> >> [email protected]
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "DataMapper" group.
> > 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
> > athttp://groups.google.com/group/datamapper?hl=en.
>
> Best regards,
> Zhi-Qiang Lei
> [email protected]
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
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.