Module: Redirectr::ApplicationHelper

Defined in:
app/helpers/redirectr/application_helper.rb

Instance Method Summary collapse

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(options = {})
  hidden_field_tag :referrer, referrer_url.to_param, options
end

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, options = {})
  link_to title, back_or_default.to_s, options.merge(rel: 'back')
end