Skip to content

Instantly share code, notes, and snippets.

View califa's full-sized avatar
🙃
joel

Joel Califa califa

🙃
joel
View GitHub Profile
@califa
califa / user.rb
Created May 8, 2011 23:56
Capitalize call
class User < ActiveRecord::Base
attr_accessor :password
EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
validates :first_name, :presence => true, :length => { :maximum => 50 }
validates :last_name, :presence => true, :length => { :maximum => 50 }
validates :email, :presence => true, :length => { :maximum => 100 },
:format => EMAIL_REGEX, :confirmation => true
@califa
califa / _form.html.erb
Created May 8, 2011 20:53
LMS Ruby Project
<%= error_messages_for(@user) %>
<table summary="User form fields">
<% if @page_title == 'Create User' %>
<tr>
<th><%= f.label(:type, "User Type") %></th>
<td><%= f.select(:type, ["Admin", "Teacher", "User"]) %></td>
</tr>
<% end %>
<tr>