On Thu, Feb 23, 2012 at 7:39 AM, Philipp Kursawe <[email protected]> wrote:
> Its not called at all:
>
> after :create do |license|
>  puts "Creating slots"
>  if 0 == Slot.import_legacy(license.id)
>    license.create_slots
>  end
> end
>
> The console does not show the "Creating slots" text.
>

What Igor asked, are you sure (without having the after hook) that the
data are saved correctly to the database? Maybe you can also do:
yourobject.saved? and he answer to this question for you.

> @Piotr: I would have to override new and create for that to work,
> correct?
>

Surely Piotr will answer in another way, but I'll override #create and
if you want to use .new, really want,  i'll override #save and not
new.


def create; <youthings>; super; end
def save; <yourthings>; super; end


Cheers,
Francesco

> On Feb 23, 2:17 am, Igor Elland <[email protected]> wrote:
>> Just too be sure, the hook is not being called or the condition is never 
>> satisfied and it gives you the impression the hook is not being called?
>>
>> On 22. feb. 2012, at 23:13, Philipp Kursawe wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Hello,
>>
>> > I love DM but this issue is driving me crazy:
>>
>> > after :create do |license|
>> >  if 0 == Slot.import_legacy(license.id)
>> >    license.create_slots
>> >  end
>> > end
>>
>> > This hook is never called. Neither with License.new.save  nor with
>> > License.create
>> > The license object is saved but the hook is not called.
>>
>> > Any ideas or workarounds?
>>
>> > Thanks!
>>
>> > --
>> > 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.
>
> --
> 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.
>

-- 
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.

Reply via email to