Skip to content

Instantly share code, notes, and snippets.

@jesjos
Created February 12, 2011 12:15
Show Gist options
  • Save jesjos/823725 to your computer and use it in GitHub Desktop.
Save jesjos/823725 to your computer and use it in GitHub Desktop.
# 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