Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

Can't specify multiple subsites on a lifecycle transition #70

Open hbaragar opened 10 years ago

hbaragar commented 10 years ago

I have an application where the same transitions are to be enabled on multiple subsites. Rather than duplicating the transition code, it would be better to pass multiple subsites to the :subsite directive.

Existing code in hobo/model/lifecycles/actions.rb

def routable_for?(subsite)
  publishable? && options[:subsite] == subsite
end

Suggested (untested) improvement:

def routable_for?(subsite)
  subsites = options[:subsite]
  subsites = [subsites] unless subsites.respond_to? :member?
  publishable? && subsites.member? subsite
end
iox commented 10 years ago

Thanks for the code suggestion Henry. I'll try to implement this :)