Permalink
Browse files

fixing association conditions when MetaWhere is installed (thanks acm…

…etech) - closes #261
  • Loading branch information...
ryanb committed Mar 8, 2011
1 parent 79995e4 commit 52435e97d9e30bc8fa7f3cb24959ec5f1c6a9187
Showing with 2 additions and 1 deletion.
  1. +1 −0 Gemfile
  2. +1 −1 lib/cancan/model_adapters/active_record_adapter.rb
View
@@ -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"
@@ -36,7 +36,7 @@ def tableized_conditions(conditions, model_class = @model_class)
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

0 comments on commit 52435e9

Please sign in to comment.