Module: MystroVolley::ApplicationHelper

Included in:
ApplicationController, HomeController
Defined in:
app/helpers/mystro_volley/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#path_helper(o) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/mystro_volley/application_helper.rb', line 3

def path_helper(o)
  case o.class
    when MystroVolley::Project then root_path + "#{o.name}"
    when MystroVolley::Branch then root_path + "#{o.project.name}/#{o.name}"
    when MystroVolley::Version then root_path + "#{o.project.name}/#{o.branch.name}/#{o.name}"
    else root_path
  end
rescue => e
  flash.now[:error] = "could not find path for #{o}"
  root_path
end