Created
December 28, 2011 17:56
-
-
Save paneq/1528878 to your computer and use it in GitHub Desktop.
Initial situation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for(@user) do |f| %> | |
<fieldset> | |
<div class="clearfix <%= @user.errors[:login].present? ? :error : nil %>"> | |
<%= f.label :login %><br /> | |
<div class="input"> | |
<span class="help-block"> | |
Your login. You know... login. | |
</span> | |
<%= f.text_field :login, :class => "xxlarge" %> | |
<% @user.errors[:login].each do |err| %> | |
<span class="help-block"> | |
<p><%= err %></p> | |
</end> | |
<% end%> | |
</div> | |
</div> | |
</fieldset> | |
<div class="actions"> | |
<%= f.submit %> | |
</div> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
validates :login, :length => { :in => 2..10 } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment