Skip to content

Commit

Permalink
[#780] handle magic options in all positions for auto_actions
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr committed Sep 20, 2011
1 parent 2367f9f commit 982e7b3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions hobo/lib/hobo/controller/model.rb
Expand Up @@ -129,23 +129,25 @@ def web_method(web_name, options={}, &block)
def auto_actions(*args)
options = args.extract_options!

@auto_actions = case args.first
@auto_actions = args.map do |arg|
case arg
when :all then available_auto_actions
when :write_only then available_auto_write_actions + args.rest
when :read_only then available_auto_read_actions + args.rest
when :lifecycle then available_auto_lifecycle_actions + args.rest
else args
end
when :write_only then available_auto_write_actions
when :read_only then available_auto_read_actions
when :lifecycle then available_auto_lifecycle_actions
else arg
end
end.flatten.uniq

except = Array(options[:except])
except_actions = except.map do |arg|
case arg
when :lifecycle then available_auto_lifecycle_actions
else arg
end
end
end.flatten.uniq

@auto_actions -= except_actions.flatten
@auto_actions -= except_actions

def_auto_actions
end
Expand Down

0 comments on commit 982e7b3

Please sign in to comment.