diff --git a/Gemfile b/Gemfile index 5edd03d..e64d3a8 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem 'rails' group :development do gem 'rspec-rails' gem 'sqlite3' + gem 'annotate-models' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 3967abd..79f47db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,6 +28,7 @@ GEM activemodel (= 3.0.7) activesupport (= 3.0.7) activesupport (3.0.7) + annotate-models (1.0.4) arel (2.0.9) builder (2.1.2) diff-lcs (1.1.2) @@ -89,6 +90,7 @@ PLATFORMS x86-mingw32 DEPENDENCIES + annotate-models rails rspec rspec-rails diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d54d3ca..2ddd7f3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,4 +4,8 @@ def new @title = "Sign up" end + def show + @user = User.find(params[:id]) + end + end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6912e62..e094c52 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,4 +9,9 @@ def title end end + def logo + image_tag("logo.png", :alt => "Sample App", :class => "round") + end + + end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..220512a --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,22 @@ +# == Schema Information +# Schema version: 20110424142757 +# +# Table name: users +# +# id :integer not null, primary key +# name :string(255) +# email :string(255) +# created_at :datetime +# updated_at :datetime +# + +class User < ActiveRecord::Base + attr_accessible :name, :email + + validates :name, :presence => true, + :length => { :maximum => 50 } + validates :email, :presence => true, + :format => { :with => /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }, + :uniqueness => true + +end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 10f8943..32b46f8 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,5 +1,5 @@
- <%= link_to image_tag("logo.png", :alt => "Sample App", :class => "round"), "/"%> + <%= link_to logo, "/"%>