public Method

Segment.all_optionals_available_condition(prior_segments)

Return an if condition that is true if all the prior segments can be generated. If there are no optional segments before this one, then nil is returned.

Source Code

# File action_controller/routing/segments.rb, line 45
def all_optionals_available_condition(prior_segments)
  optional_locals = prior_segments.collect { |s| s.local_name if s.optional? && s.respond_to?(:local_name) }.compact
  optional_locals.empty? ? nil : " if #{optional_locals * ' && '}"
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.