Module: ShouldaRouting::Routes::Helpers

Included in:
Stack
Defined in:
lib/shoulda_routing/routes/helpers.rb

Instance Method Summary collapse

Instance Method Details

#params(stack) ⇒ Object



9
10
11
12
13
# File 'lib/shoulda_routing/routes/helpers.rb', line 9

def params stack
  params = {}
  stack.each{ |e| params[:"#{e.to_s.singularize}_id"] = "1" }
  params
end

#permutations(stack) ⇒ Object



5
6
7
# File 'lib/shoulda_routing/routes/helpers.rb', line 5

def permutations stack
  stack.inject(&:product).map{|e| e.flatten rescue [e]}
end