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
# this is a basic rails application template | |
# usage: rails <app_name> -m http://gist.github.com/114140.txt OR rails -d mysql .... | |
puts "" | |
puts "*******************************************************" | |
puts "" | |
puts "Basic Rails application generator with:" | |
puts " - MySQL support (creating development, test and production databases with configuration file database.yml)" | |
puts " - HAML/SASS/Compass support" | |
puts " - BDD support: Cucumber, RSpec, autospec" |
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
autotest-all: --require features --require lib --format progress features | |
autotest: --require features --require lib features | |
default: --format pretty | |
html: --format html --out features.html |
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
y | |
n |
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
!!! | |
%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"} | |
%head | |
= stylesheet_link_tag 'screen.css', :media => 'screen, projection' | |
= stylesheet_link_tag 'print.css', :media => 'print' | |
/[if IE] | |
= stylesheet_link_tag 'ie.css', :media => 'screen, projection' | |
= stylesheet_link_tag 'application', :media => 'screen, projection' | |
%body.container | |
#header |
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
# authentication based on authlogic | |
if yes?("Load the Basic Rails template?") | |
run "wget http://gist.github.com/114140.txt" | |
run "mv 114140.txt base_template.rb" | |
load_template "base_template.rb" | |
end | |
if yes?("(Re)Install Authlogic?") | |
run "sudo gem install authlogic" |
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 UserSessionsController < ApplicationController | |
before_filter :require_no_user, :only => [:new, :create] | |
before_filter :require_user, :only => :destroy | |
def new | |
@user_session = UserSession.new | |
end | |
def create | |
@user_session = UserSession.new(params[:user_session]) |
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 UsersController < ApplicationController | |
before_filter :require_no_user, :only => [:new, :create] | |
before_filter :require_user, :only => [:show, :edit, :update] | |
def new | |
@user = User.new | |
end | |
def create | |
@user = User.new(params[:user]) |
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 ApplicationController < ActionController::Base | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
filter_parameter_logging :password, :password_confirmation | |
helper_method :current_user_session, :current_user | |
private | |
def current_user_session | |
return @current_user_session if defined?(@current_user_session) |
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
= content_for :content do | |
%h1 Login | |
- form_for @user_session do |f| | |
= f.error_messages | |
= f.label :login | |
%br | |
= f.text_field :login | |
%br | |
%br |
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
= content_for :content do | |
%h1 Edit My Account</h1> | |
- form_for @user, :url => account_path do |f| | |
= f.error_messages | |
= render :partial => "form", :object => f | |
= f.submit "Update" | |
%br | |
= link_to "My Profile", account_path |
OlderNewer