medBouzid
medBouzid

Reputation: 8422

What is difference between after_create :some_method and after_create do end

what is the main difference between these two callbacks ?

after_create do
  # ...
end

and

after_create :some_method

def some_method
   # ....
end

Upvotes: 0

Views: 53

Answers (1)

Bart
Bart

Reputation: 2656

To wrap things up:

There is no difference in behaviour. First one is yielding the block while the second option is calling a method. The latter is more common though.

Controllers have after_filter and before_filter callbacks, which is working in the same way

Upvotes: 1

Related Questions