Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing association conditions when MetaWhere is installed (thanks acm…

…etech) - closes #261
  • Loading branch information...
commit 52435e97d9e30bc8fa7f3cb24959ec5f1c6a9187 1 parent 79995e4
@ryanb authored
Showing with 2 additions and 1 deletion.
  1. +1 −0  Gemfile
  2. +1 −1  lib/cancan/model_adapters/active_record_adapter.rb
View
1  Gemfile
@@ -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
2  lib/cancan/model_adapters/active_record_adapter.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.