Flowdock
method

sms_to

Importance_2
v6.1.3.1 - Show latest stable - 0 notes - Class: ActionView::Helpers::UrlHelper
  • 1.0.0
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.2
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1
  • 5.1.7
  • 5.2.3
  • 6.0.0
  • 6.1.3.1 (0)
  • What's this?
sms_to(phone_number, name = nil, html_options = {}, &block) public

Creates an SMS anchor link tag to the specified phone_number, which is also used as the name of the link unless name is specified. Additional HTML attributes for the link can be passed in html_options.

When clicked, an SMS message is prepopulated with the passed phone number and optional body value.

sms_to has a body option for customizing the SMS message itself by passing special keys to html_options.

Options

  • :body - Preset the body of the message.

Examples

sms_to "5155555785"
# => <a href="sms:5155555785;">5155555785</a>

sms_to "5155555785", "Text me"
# => <a href="sms:5155555785;">Text me</a>

sms_to "5155555785", "Text me",
       body: "Hello Jim I have a question about your product."
# => <a href="sms:5155555785;?body=Hello%20Jim%20I%20have%20a%20question%20about%20your%20product">Text me</a>

You can use a block as well if your link target is hard to fit into the name parameter. ERB example:

<%= sms_to "5155555785" do %>
  <strong>Text me:</strong>
<% end %>
# => <a href="sms:5155555785;">
       <strong>Text me:</strong>
     </a>
Show source
Register or log in to add new notes.