Created
February 12, 2011 12:15
-
-
Save jesjos/823725 to your computer and use it in GitHub Desktop.
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
# views/layouts/application.html.haml | |
!!! | |
%html | |
%head | |
%body | |
%nav#menu | |
Some content | |
#wrapper | |
%section#content | |
= yield | |
%footer#footer | |
Content | |
#login | |
#x-button X | |
= render :partial => "users/new" | |
# views/users/_new.html.haml | |
%h1 Sign Up | |
= form_for @user do |f| | |
- if @user.errors.any? | |
.error_messages | |
%h2 Form is invalid | |
%ul | |
- for message in @user.errors.full_messages | |
%li= message | |
%p | |
= f.label :email | |
%br | |
= f.text_field :email | |
%p | |
= f.label :password | |
%br | |
= f.password_field :password | |
%p | |
= f.label :password_confirmation | |
%br | |
= f.password_field :password_confirmation | |
%p.button= f.submit | |
# controllers/users_controller.rb | |
class UsersController < ApplicationController | |
def new | |
@user = User.new | |
end | |
def create | |
@user = User.new(params[:user]) | |
if @user.save | |
redirect_to pages_start_url, :notice => "Registered" | |
else | |
render "new" | |
end | |
end | |
end | |
# controllers/pages_controller.rb | |
class PagesController < ApplicationController | |
def start | |
end | |
# other similar actions | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment