Skip to content

Commit

Permalink
use define_model_callbacks instead of define_callbacks
Browse files Browse the repository at this point in the history
ActiveSupport::Callbacks.define_callbacks doesn't define the class
macros to create callbacks (anymore?). This means that in 2.0.0,
before_move, after_move, and around_move are missing.

ActiveModel::Callbacks.define_model_callbacks handles defining the
macros, and as a bonus adds the `:terminator` option itself.
  • Loading branch information
Kevin Bullock committed May 12, 2011
1 parent a84d142 commit 8ca6491
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/awesome_nested_set/awesome_nested_set.rb
Expand Up @@ -88,7 +88,7 @@ def #{column}=(x)
scope :roots, where(parent_column_name => nil).order(quoted_left_column_name)
scope :leaves, where("#{quoted_right_column_name} - #{quoted_left_column_name} = 1").order(quoted_left_column_name)

define_callbacks :move, :terminator => "result == false"
define_model_callbacks :move
end

module Model
Expand Down Expand Up @@ -561,4 +561,4 @@ def quoted_scope_column_names

end
end
end
end

0 comments on commit 8ca6491

Please sign in to comment.