code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
require 'digest/sha1'
class User < ActiveRecord::Base
has_many :commitments, :dependent=>:destroy
has_many :schedules, :dependent=>:destroy
include Authentication
include Authentication::ByPassword
include Authentication::ByCookieToken
validates_presence_of :login
validates_length_of :login, ... | Ruby |
class Teaching < ActiveRecord::Base
belongs_to :event
belongs_to :instructor
# This method returns the concatnation of name and, if they're available, effectiveness/usefulness.
def name_stat
if usefulness and effectiveness
myUsefulness = ((usefulness * 100).to_i)/100.0
myEffectiveness = ((effec... | Ruby |
class Instructor < ActiveRecord::Base
has_many :teachings
has_many :events, :through=>:teachings, :dependent=>:destroy
validates_presence_of :first_name
validates_presence_of :last_name
def name
first_name + " " + last_name
end
def Instructor.find_by_lastname(name)
r = Instructor.find(:all, :con... | Ruby |
class Discussion < Event
validates_uniqueness_of :ccn
end
| Ruby |
class Lecture < Event
validates_uniqueness_of :ccn
def alternative_lectures
lectures = self.course.lectures
return lectures.select{ |l| l != self}
end
def Lecture.find_by_ccn(ccn)
return find(:first, :conditions => { :ccn => ccn })
end
def discussions
self.course.discussions
end
def ... | Ruby |
class DepartmentAbbreviation < ActiveRecord::Base
validates_presence_of :department
validates_presence_of :abbreviation
def DepartmentAbbreviation.add_unless_dup(department, abbreviation)
return if DepartmentAbbreviation.count(:all, :conditions => {:department => department.upcase, :abbreviation => abbrevi... | Ruby |
class ScheduledItem < ActiveRecord::Base
belongs_to :schedule
belongs_to :event
end
| Ruby |
require 'uri'
class SearchController < ApplicationController
def default_result_size
5
end
# This is the first page shown when accessing ARC scheduler
# When user searches, it shows the search results
# GET /index
# GET /index.xml
def index
if params[:query] and params[:query].length... | Ruby |
class SchedulesController < ApplicationController
# GET /schedules
# GET /schedules.xml
def index
# if user logged in (Don't worry about this case for now)
# find all schedules of user
# populate schedules tab with schedule names
# display the most recent schedule
# else
@schedule... | Ruby |
class EventsController < ApplicationController
# GET /events
# GET /events.xml
def index
@events = Event.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @events }
end
end
# GET /events/1
# GET /events/1.xml
def show
@event = Event.find(par... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include AuthenticatedSystem
helper :all # include all helpers, all the time
protect_from_forgery # See Acti... | Ruby |
require "hpricot"
require 'rubygems'
require 'uri'
require 'open-uri'
class TermsController < ApplicationController
# GET /terms
# GET /terms.xml
def index
@terms = Term.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @terms }
end
end
# GET /term... | Ruby |
require 'open-uri'
require 'hpricot'
class DepartmentAbbreviationsController < ApplicationController
# GET /department_abbreviations
# GET /department_abbreviations.xml
def index
@department_abbreviations = DepartmentAbbreviation.all
@department_abbreviation = DepartmentAbbreviation.new
respond_to ... | Ruby |
class UsersController < ApplicationController
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
# render new.rhtml
def new
@user = User.new
end
def create
logout_keeping_session!
@user = User.new(params[:user])
success = @user && @u... | Ruby |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
# render new.rhtml
def new
end
def create
logout_keeping_session!
user = User.... | Ruby |
And 'I view one of my schedules' do
schedule = @user.schedules[0]
get "/schedules/#{schedule.id}"
end
When 'I navigate to the schedules page' do
get "/schedules/"
end | Ruby |
When /^I search for "(.*)"$/ do |query|
get "/", "query=#{query}"
end | Ruby |
And "I have added some courses to some schedules" do
@user = User.find_by_login('oona')
@schedule1 = Schedule.create({:user_id=>@user.id})
@schedule2 = Schedule.create({:user_id=>@user.id})
@schedule1.events << @cs61a_lec
@schedule2.events << @cs61b_lec
@user.schedules << @schedule1
@user.schedules << @sc... | Ruby |
#
# What you should see when you get there
#
#
# Destinations. Ex:
# She should be at the new kids page
# Tarkin should be at the destroy alderaan page
# The visitor should be at the '/lolcats/download' form
# The visitor should be redirected to '/hi/mom'
#
# It doesn't know anything about actual routes -- it... | Ruby |
RE_User = %r{(?:(?:the )? *(\w+) *)}
RE_User_TYPE = %r{(?: *(\w+)? *)}
#
# Setting
#
Given "an anonymous user" do
log_out!
end
Given "$an $user_type user with $attributes" do |_, user_type, attributes|
create_user! user_type, attributes.to_hash_from_story
end
Given "$an $user_type user named '$login'" do |... | Ruby |
# The flexible code for resource testing came out of code from Ben Mabey
# http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/
#
# Construct resources
#
#
# Build a resource as described, store it as an @instance variable. Ex:
# "Given a user with login: 'mojojojo'"
# produces a User in... | Ruby |
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
# Commonly used webrat steps
# http://github.com/brynary/webrat
Given /^I am on (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^I go to (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^I press "([^\"]*)"$/ d... | Ruby |
Then 'I should see a link to my other schedules' do
response.should have_text(/\/schedules\/#{@user.schedules[1].id}/)
end
Then 'the schedule should be deleted' do
selenium.chooseOkOnNextConfirmation()
puts @user.schedules.length
end
Then 'I should see my other schedules' do
response.should have_text(/<li><a ... | Ruby |
Given 'courses database is populated' do
@valid_attributes = {
:start_date => Time.now,
:end_date => Time.now,
:name => "value for name"
}
@fall2009 = Term.create!({
:start_date => Date.parse("August 26, 2009"),
:end_date => Date.parse("December 11, 2009"),
:name => "Fall 2009",
})
@... | Ruby |
# If you have a global stories helper, move this line there:
include AuthenticatedTestHelper
# Most of the below came out of code from Ben Mabey
# http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/
# These allow exceptions to come through as opposed to being caught and having non-helpful... | Ruby |
#
# Where to go
#
#
# GET
# Go to a given page.
When "$actor goes to $path" do |actor, path|
case path
when 'the home page' then get '/'
else get path
end
end
# POST -- Ex:
# When she creates a book with ISBN: '0967539854' and comment: 'I love this book' and rating: '4'
# When she cre... | Ruby |
Before do
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, 'spec', 'fixtures')
Fixtures.create_fixtures(fixtures_folder, "users")
end
# Make visible for testing
ApplicationController.send(:public, :logged_in?, :current_user, :authorized?)
| Ruby |
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in webrat_steps.rb
#
def path_to(page_name)
case page_name
when /the homepage/
'/'
# Add more mappings here.
# Here is a more fancy example:
#
... | Ruby |
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
# Whether or not to run each scenario within a database transaction.
#
# If you leave this to true, you can turn off traqnsactions o... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person',... | Ruby |
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying do debug a probl... | Ruby |
# A Site key gives additional protection against a dictionary attack if your
# DB is ever compromised. With no site key, we store
# DB_password = hash(user_password, DB_user_salt)
# If your database were to be compromised you'd be vulnerable to a dictionary
# attack on all your stupid users' passwords. With a site... | Ruby |
# Be sure to restart your server when you modify this file.
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveReco... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Act... | Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :schedules
map.resources :events
map.resources :terms
map.connect 'department_abbreviations/fetch_list', :controller => 'department_abbreviations', :action => 'fetch_list'
map.resources :department_abbreviations
map.logout '/logout', :controller... | Ruby |
# Replace with the HTTP (NOT HTTPS) read-only URL of your Google Code SVN.
set :repository, "http://cs194-arc.googlecode.com/svn/trunk/arc/"
# Directory for deployment on the production (remote) machine.
set :deploy_to, "/mnt/app"
# Replace the below with the hostname of your EC2 instance.
set :machine_name, "ec2-174... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
config.cache_classes = true # This must be true for Cucumber to operate correctly!
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
module AuthenticatedSystem
protected
# Returns true or false if the user is logged in.
# Preloads @current_user with the user model if they're logged in.
def logged_in?
!!current_user
end
# Accesses the current user from the session.
# Future calls avoid the database because nil is not ... | Ruby |
module AuthenticatedTestHelper
# Sets the current user in the session from the user fixtures.
def login_as(user)
@request.session[:user_id] = user ? (user.is_a?(User) ? user.id : users(user).id) : nil
end
def authorize_as(user)
@request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentic... | Ruby |
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
unless ARGV.any? {|a| a =~ /^gems/}
begin
require 'cucumber/rake/task'
namespace :cucumber do
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do... | Ruby |
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
rspec_gem_dir = nil
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
end
rspec_plugin_dir = File.expand_path(Fil... | Ruby |
namespace :fake_data do
task :insert => :environment do
harvey = Instructor.new(:first_name=>"Brian",:last_name=>"Harvey",:url=>"http://cs.berkeley.edu/~bh")
if harvey.save
puts "Brian Harvey Created Successfully"
else
harvey = Instructor.find(:first,:conditions=>{:first_name=>'Brian',:last_na... | Ruby |
print "EXTRA CREDIT: So when I deleted the index.html, it routed to localhost:3000/movies fine, but when I placed a simple index.html into the public directory, localhost:3000 routed to the index.html. It seems like the presence of an index.html in there overrides the map.root command in the routes.rb file I editted." | Ruby |
print "It looks like the parse definition in the time class "
print "does not actually use 'self' in any of its body code "
print "and therefore you cannot use the latter syntax. "
print "But if you wanted to use the latter syntax, you might "
print "run into a little trouble, because it looks like "
print "the st... | Ruby |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Review do
before(:each) do
@valid_attributes = {
:user_id => 1,
:movie_id => 1,
:score => 1
}
end
it "should create a new instance given valid attributes"
it "should not be valid with a score of 6"
... | Ruby |
# Be sure to overwrite features/support/paths.rb with this file.
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in webrat_steps.rb
#
def path_to(page_name)
case page_name
when /the homepage/
'/'
when /the... | Ruby |
RE_User = %r{(?:(?:the )? *(\w+) *)}
RE_User_TYPE = %r{(?: *(\w+)? *)}
#
# Setting
#
Given "an anonymous user" do
log_out!
end
Given "$an $user_type user with $attributes" do |_, user_type, attributes|
create_user! user_type, attributes.to_hash_from_story
end
Given "$an $user_type user named '$login'" do |... | Ruby |
# copy this file to features/step_definitions subdirectory
# Givens
Given /^I am logged in as "([^\"]*)"$/ do |username|
user_params = { :login => username, :name => username,
:password => 'dummy1', :password_confirmation => 'dummy1',
:email => "#{username}@#{username}.com"}
@user = User.create!(user_para... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person',... | Ruby |
# Be sure to restart your server when you modify this file.
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveReco... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Act... | Ruby |
# A Site key gives additional protection against a dictionary attack if your
# DB is ever compromised. With no site key, we store
# DB_password = hash(user_password, DB_user_salt)
# If your database were to be compromised you'd be vulnerable to a dictionary
# attack on all your stupid users' passwords. With a site... | Ruby |
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying do debug a probl... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
ActionController::Routing::Routes.draw do |map|
# map.resources :reviews
# hmmm stuck on number 6
# not sure how to do this
# i will just look at the solutions
# midterms are more important
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.login '/login', :controller => 's... | Ruby |
if Cucumber::VERSION::STRING != '0.4.0'
warning = <<-WARNING
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
(::) R O T T E N C U C U M B E R A L E R T (::)
Your #{__FILE__.gsub(/version_check.rb$/, 'env.rb')} file was generated with Cucumber 0.4.0,
but you seem to be run... | Ruby |
# Be sure to overwrite features/support/paths.rb with this file.
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in webrat_steps.rb
#
def path_to(page_name)
case page_name
when /the homepage/
'/'
when /the... | Ruby |
#
# Where to go
#
#
# GET
# Go to a given page.
When "$actor goes to $path" do |actor, path|
case path
when 'the home page' then get '/'
else get path
end
end
# POST -- Ex:
# When she creates a book with ISBN: '0967539854' and comment: 'I love this book' and rating: '4'
# When she cre... | Ruby |
# The flexible code for resource testing came out of code from Ben Mabey
# http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/
#
# Construct resources
#
#
# Build a resource as described, store it as an @instance variable. Ex:
# "Given a user with login: 'mojojojo'"
# produces a User in... | Ruby |
Before do
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, 'spec', 'fixtures')
Fixtures.create_fixtures(fixtures_folder, "users")
end
# Make visible for testing
ApplicationController.send(:public, :logged_in?, :current_user, :authorized?)
| Ruby |
# If you have a global stories helper, move this line there:
include AuthenticatedTestHelper
# Most of the below came out of code from Ben Mabey
# http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/
# These allow exceptions to come through as opposed to being caught and having non-helpful... | Ruby |
#
# What you should see when you get there
#
#
# Destinations. Ex:
# She should be at the new kids page
# Tarkin should be at the destroy alderaan page
# The visitor should be at the '/lolcats/download' form
# The visitor should be redirected to '/hi/mom'
#
# It doesn't know anything about actual routes -- it... | Ruby |
RE_User = %r{(?:(?:the )? *(\w+) *)}
RE_User_TYPE = %r{(?: *(\w+)? *)}
#
# Setting
#
Given "an anonymous user" do
log_out!
end
Given "$an $user_type user with $attributes" do |_, user_type, attributes|
create_user! user_type, attributes.to_hash_from_story
end
Given "$an $user_type user named '$login'" do |... | Ruby |
# copy this file to features/step_definitions subdirectory
# Givens
Given /^I am logged in as "([^\"]*)"$/ do |username|
user_params = { :login => username, :name => username,
:password => 'dummy1', :password_confirmation => 'dummy1',
:email => "#{username}@#{username}.com"}
@user = User.create!(user_para... | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module UsersHelper
#
# Use this to wrap view elements that the user can't access.
# !! Note: this is an *interface*, not *security* feature !!
# You need to do all access control at the controller level.
#
# Example:
# <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> ... | Ruby |
module ReviewsHelper
end
| Ruby |
module SessionsHelper
end | Ruby |
module HomeHelper
end
| Ruby |
module MoviesHelper
end
| Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
include Authentication
include Authentication::ByPassword
include Authentication::ByCookieToken
has_many :movies, :dependent => :destroy
validates_presence_of :login
validates_length_of :login, :within => 3..40
validates_unique... | Ruby |
class Movie < ActiveRecord::Base
has_many :reviews, :dependent => :destroy
validates_presence_of :title, :description
validates_uniqueness_of :title
validates_length_of :description, :minimum => 10
validates_inclusion_of :rating, :in => %w{ G PG PG-13 R NC-17 }
def self.find_all_appropriate_f... | Ruby |
class Review < ActiveRecord::Base
belongs_to :user
belongs_to :movie
validates_inclusion_of :score, :in => 1..5
validates_presence_of :user_id
validates_presence_of :movie_id
validates_uniqueness_of :user_id, :scope => :movie_id, :message => "You can only review a movie once."
end
| Ruby |
class HomeController < ApplicationController
before_filter :login_required
def dashboard
@movies = Movie.find_all_appropriate_for_birthdate(current_user.birthdate)
end
end
| Ruby |
class ReviewsController < ApplicationController
before_filter :get_movie
before_filter :login_required, :except => [:index, :show]
# before filters addeds
# GET /reviews
# GET /reviews.xml
def index
@reviews = Review.all
respond_to do |format|
format.html # index.html.erb
f... | Ruby |
class MoviesController < ApplicationController
before_filter :login_required, :except => [ :index, :show ]
# GET /movies
# GET /movies.xml
def index
@movies = Movie.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @movies }
end
end
# GET /movies... | Ruby |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
# render new.rhtml
def new
end
def create
logout_keeping_session!
user = User.authenticate(params[:login], params[:password])
if user
# Protects against session fixation attacks... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include AuthenticatedSystem
helper :all # include all helpers, all the time
protect_from_forgery # See A... | Ruby |
class UsersController < ApplicationController
# render new.rhtml
def new
@user = User.new
end
def create
logout_keeping_session!
@user = User.new(params[:user])
success = @user && @user.save
if success && @user.errors.empty?
# Protects against session fixation attacks, causes request... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.