fixing association conditions when MetaWhere is installed (thanks acmetech) - closes #261

This commit is contained in:
Ryan Bates 2011-03-08 10:07:36 -08:00
parent 79995e4309
commit 52435e97d9
2 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ when nil, "active_record"
gem "sqlite3-ruby", :require => "sqlite3"
gem "activerecord", :require => "active_record"
gem "with_model"
gem "meta_where"
when "data_mapper"
gem "dm-core", "~> 1.0.2"
gem "dm-sqlite-adapter", "~> 1.0.2"

View File

@ -36,7 +36,7 @@ module CanCan
conditions.inject({}) do |result_hash, (name, value)|
if value.kind_of? Hash
association_class = model_class.reflect_on_association(name).class_name.constantize
name = model_class.reflect_on_association(name).table_name
name = model_class.reflect_on_association(name).table_name.to_sym
value = tableized_conditions(value, association_class)
end
result_hash[name] = value