fixing association conditions when MetaWhere is installed (thanks acmetech) - closes #261
This commit is contained in:
parent
79995e4309
commit
52435e97d9
1
Gemfile
1
Gemfile
|
@ -5,6 +5,7 @@ when nil, "active_record"
|
||||||
gem "sqlite3-ruby", :require => "sqlite3"
|
gem "sqlite3-ruby", :require => "sqlite3"
|
||||||
gem "activerecord", :require => "active_record"
|
gem "activerecord", :require => "active_record"
|
||||||
gem "with_model"
|
gem "with_model"
|
||||||
|
gem "meta_where"
|
||||||
when "data_mapper"
|
when "data_mapper"
|
||||||
gem "dm-core", "~> 1.0.2"
|
gem "dm-core", "~> 1.0.2"
|
||||||
gem "dm-sqlite-adapter", "~> 1.0.2"
|
gem "dm-sqlite-adapter", "~> 1.0.2"
|
||||||
|
|
|
@ -36,7 +36,7 @@ module CanCan
|
||||||
conditions.inject({}) do |result_hash, (name, value)|
|
conditions.inject({}) do |result_hash, (name, value)|
|
||||||
if value.kind_of? Hash
|
if value.kind_of? Hash
|
||||||
association_class = model_class.reflect_on_association(name).class_name.constantize
|
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)
|
value = tableized_conditions(value, association_class)
|
||||||
end
|
end
|
||||||
result_hash[name] = value
|
result_hash[name] = value
|
||||||
|
|
Loading…
Reference in New Issue
Block a user