Skip to content

Commit

Permalink
resolve issue 149
Browse files Browse the repository at this point in the history
  • Loading branch information
funny-falcon authored and ryanb committed Sep 16, 2010
1 parent 0b270f2 commit f236b1b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/cancan/can_definition.rb
Expand Up @@ -41,6 +41,7 @@ def matches_conditions?(action, subject, extra_args)
end

def tableized_conditions(conditions = @conditions)
return conditions unless conditions.kind_of? Hash
conditions.inject({}) do |result_hash, (name, value)|
if value.kind_of? Hash
name = name.to_s.tableize.to_sym
Expand All @@ -63,15 +64,15 @@ def associations_hash(conditions = @conditions)
hash = {}
conditions.map do |name, value|
hash[name] = associations_hash(value) if value.kind_of? Hash
end
end if conditions.kind_of? Hash
hash
end

def attributes_from_conditions
attributes = {}
@conditions.each do |key, value|
attributes[key] = value unless [Array, Range, Hash].include? value.class
end
end if conditions.kind_of? Hash
attributes
end

Expand Down

0 comments on commit f236b1b

Please sign in to comment.