Module: Redirectr::ApplicationHelper
- Defined in:
- app/helpers/redirectr/application_helper.rb
Instance Method Summary collapse
-
#hidden_referrer_input_tag(options = {}) ⇒ Object
Create a hidden input field containing the referrer or current path.
-
#link_to_back(title, options = {}) ⇒ Object
Create a link back to the path specified in the referrer-param.
Instance Method Details
#hidden_referrer_input_tag(options = {}) ⇒ Object
Create a hidden input field containing the referrer or current path. Handy for use in forms that are called with a referrer param which has to be passed on and respected by the form processing action.
14 15 16 |
# File 'app/helpers/redirectr/application_helper.rb', line 14 def hidden_referrer_input_tag( = {}) hidden_field_tag :referrer, referrer_url.to_param, end |
#link_to_back(title, options = {}) ⇒ Object
Create a link back to the path specified in the referrer-param. title can be either a text string or anything else like an image. Remember to call #html_safe on the title argument if it contains HTML and you are using Rails >=3.
7 8 9 |
# File 'app/helpers/redirectr/application_helper.rb', line 7 def link_to_back(title, = {}) link_to title, back_or_default.to_s, .merge(rel: 'back') end |