Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#store_list_for and #list_for fixed: previously compacted only with v…
…alues, now do it for values AND a block.
  • Loading branch information
chrisberkhout authored and benhoskings committed Feb 24, 2011
1 parent 068bebf commit b137ab1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/babushka/accepts_list_for.rb
Expand Up @@ -19,7 +19,7 @@ def #{method_name} *args, &block
elsif args.blank? && block.nil?
#{opts[:type]}_for #{method_name.inspect}, #{default.inspect}
else
store_#{opts[:type]}_for #{method_name.inspect}, block || [*args.compact].flatten, #{opts[:choose_with].inspect}
store_#{opts[:type]}_for #{method_name.inspect}, block || [*args].flatten, #{opts[:choose_with].inspect}
self
end
end
Expand All @@ -37,7 +37,7 @@ def store_list_for method_name, data, choose_with

def list_for method_name, default
if payload.has_key? method_name
payload[method_name].map {|i| i.respond_to?(:call) ? i.call : i }
payload[method_name].map {|i| i.respond_to?(:call) ? i.call : i }.compact
else
[*(default.is_a?(Symbol) ? send(default) : (default || []))]
end
Expand Down

0 comments on commit b137ab1

Please sign in to comment.