Class: ScaffoldMarkup::Helpers::UrlHelper
- Inherits:
-
Object
- Object
- ScaffoldMarkup::Helpers::UrlHelper
- Defined in:
- lib/scaffold_markup/helpers/url_helper.rb
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #edit_resource(model_instance) ⇒ Object
-
#initialize(template) ⇒ UrlHelper
constructor
A new instance of UrlHelper.
- #list_resource(model_class) ⇒ Object
- #new_resource(model_class) ⇒ Object
- #resource(model_instance) ⇒ Object
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
#template ⇒ Object (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 |