lib/dm-is-published/is/published.rb in dm-is-published-0.0.2 vs lib/dm-is-published/is/published.rb in dm-is-published-0.0.3

- old
+ new

@@ -97,13 +97,13 @@ # # # == Errors / Bugs # # If something is not behaving intuitively, it is a bug, and should be reported. - # Report it here: http://datamapper.lighthouseapp.com/ + # Report it here: http://github.com/kematzy/dm-is-published/issues # - # === Credits + # == Credits # # Copyright (c) 2008-05-07 [Kematzy at gmail] # # Loosely based on the ActsAsPublishable plugin by [http://fr.ivolo.us/posts/acts-as-publishable] # @@ -201,21 +201,24 @@ # incoming can either be: # -- nil (nothing passed in, so just use super ) # -- (Hash) => all(:key => "value") ( normal operations, so just pass on the Hash ) # -- (Symbol) => all(:draft) ( just get the symbol, ) # -- (Symbol, Hash ) => :draft, { extra options } + # -- (DataMapper somethings) => leave it alone if args.empty? return super - elsif args.first.is_a?(Hash) - return super(args.first) - else + elsif args.first.is_a?(Symbol) # set the from args Array, remove first item if Symbol, and then check for 2nd item's presence - state, options = args.shift.to_s, (args.blank? ? {} : args.first) if args.first.is_a?(Symbol) + state, options = args.shift.to_s, (args.blank? ? {} : args.first) # puts " and state=[#{state}] and options=[#{options.class}] options.inspect=[#{options.inspect}] [#{__FILE__}:#{__LINE__}]" - return super({ :publish_status => state }.merge(options) ) + elsif args.first.is_a?(Hash) + # puts "dm-is-published args.first was a HASH ] [#{__FILE__}:#{__LINE__}]" + return super(args.first) + else + # puts "dm-is-published (ELSE) [#{__FILE__}:#{__LINE__}]" + return super end - end end # ClassMethods module InstanceMethods