Class: ScaffoldMarkup::Helpers::UrlHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/scaffold_markup/helpers/url_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ UrlHelper

Returns a new instance of UrlHelper.



6
7
8
# File 'lib/scaffold_markup/helpers/url_helper.rb', line 6

def initialize(template)
  @template = template
end

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



4
5
6
# File 'lib/scaffold_markup/helpers/url_helper.rb', line 4

def template
  @template
end

Instance Method Details

#edit_resource(model_instance) ⇒ Object



22
23
24
# File 'lib/scaffold_markup/helpers/url_helper.rb', line 22

def edit_resource(model_instance)
  template.send "edit_#{model_instance.class.model_name.underscore}_path", model_instance.id
end

#list_resource(model_class) ⇒ Object



10
11
12
# File 'lib/scaffold_markup/helpers/url_helper.rb', line 10

def list_resource(model_class)
  template.send "#{model_class.model_name.underscore.pluralize}_path"
end

#new_resource(model_class) ⇒ Object



18
19
20
# File 'lib/scaffold_markup/helpers/url_helper.rb', line 18

def new_resource(model_class)
  template.send "new_#{model_class.model_name.underscore}_path"
end

#resource(model_instance) ⇒ Object



14
15
16
# File 'lib/scaffold_markup/helpers/url_helper.rb', line 14

def resource(model_instance)
  template.send "#{model_instance.class.model_name.underscore}_path", model_instance.id
end