lib/auth_helpers/model/associatable.rb in josevalim-auth_helpers-0.1.2 vs lib/auth_helpers/model/associatable.rb in josevalim-auth_helpers-0.2.0
- old
+ new
@@ -9,9 +9,14 @@
# attribute errors from the parent object.
#
# Finally, if the *_id in the table has also *_type. It considers a polymorphic
# association.
#
+ # Whenever using this method with polymorphic association, don't forget to
+ # set the validation scope in AuthLogic.
+ #
+ # a.validations_scope = :accountable_type
+ #
module Associatable
def self.included(base)
column = base.columns.detect{|c| c.name =~ /_id$/ }
raise ScriptError, "Could not find a column that ends with id in #{base.name.tableize}" unless column