layout | title | date | comments | categories |
---|---|---|---|---|
post |
Removing leading and trailing spaces and &nbsp in Ruby |
2014-10-17 15:46:09 -0400 |
true |
- If
.strip
isn't working, try.gsub(/\A[[:space:]]+|[[:space:]]+\z/, '')
From: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html
To create a new person you typically set up a new instance of Person in the PeopleController#new action, @person, and in the view template pass that object to form_for:
<%= form_for @person do |f| %>
<%= f.label :first_name %>:
<%= f.text_field :first_name %><br />
<%= f.label :last_name %>:
<%= f.text_field :last_name %><br />