code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class PlayController < ApplicationController
before_filter :authorize
def index
@plays = Play.find(:all)
end
def show
@play = Play.find(params[:id])
end
def new
@play = Play.new
end
def edit
@play = Play.find(params[:id])
end
def create
@play = Play.new(params[:pla... | Ruby |
class RolesController < ApplicationController
layout 'layout'
def index
@roles = Role.find_all
end
def show
@role = Role.find(params[:role_id], :include => :users)
end
def update
@user = User.find(params[:id])
@user.set_role(params[:role_id])
session[:set_user_id] = @user.id ... | Ruby |
class RepliesController < ApplicationController
before_filter :find_guest_name, :only => :create
def new
@reply = Reply.new
@reply.name = session[:name] unless session[:name].nil?
end
def index
find_current_movie_and_replies :page => params[:page], :movie_id => params[:movie_id]
end
... | Ruby |
class MoviesController < ApplicationController
before_filter :find_on_show_movies, :only => [:show, :index]
before_filter :find_replies,:only => [:show]
def index
end
def show
@movie = Movie.find(params[:id])
render 'movies/layout'
end
def create
begin
@movie = Movie.create!(par... | Ruby |
class CinemasController < ApplicationController
before_filter :authorize, :only => [:new, :edit, :create, :update, :destroy, :admin_index]
layout 'admin_layout'
def site_index
end
def admin_index
end
def index
@cinemas = Cinema.find(:all)
end
def show
@cinema = Cinema.find(param... | Ruby |
class MoviePicsController < ApplicationController
layout 'layouts/admin_layout'
def create
attachment = MoviePic.batch_create(:attachments => params[:movie_pics], :movie_id => params[:id])
if attachment[:exception] == "true"
flash[:notice] = attachment[:flash]
redirect_to :back
... | Ruby |
class RoleshipsController < ApplicationController
def update
end
end
| Ruby |
class SessionController < ApplicationController
include SimpleCaptcha::ControllerHelpers
layout "layout"
def new
end
def create
if simple_captcha_valid?
session[:user_id] = nil
user = User.authenticate(params[:name], params[:password])
if user
session[:user_id] = user.id... | 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
# Pick a unique cookie name to distinguish our session data from others'
include SimpleCaptcha::Controller... | Ruby |
class AdminMoviesController < ApplicationController
before_filter :authorize
layout 'layouts/admin_layout'
def index
if params[:movies] == 'on_show'
@movies = Movie.find_all_by_show_status('on')
else
if 'off_show' == params[:movies]
@movies = Movie.find_all_by_show_status('off')
... | Ruby |
class UsersController < ApplicationController
layout 'layout'
before_filter :authorize, :except => [:new, :create]
def index
@users = User.paginate :page => params[:page]
end
def show
unless params[:id].blank?
@user = User.find params[:id]
else
@user = current_user
end
... | 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/breakpointer' | 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 |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | 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/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | 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/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
class AddColumnToMoviePic1 < ActiveRecord::Migration
def self.up
add_column :movie_pics, :cover, :string
end
def self.down
end
end
| Ruby |
class CreateRoles < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.column :name, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table :roles
end
end
| Ruby |
class CreateMovieHouseSets < ActiveRecord::Migration
def self.up
create_table :movie_house_sets do |t|
t.column :movie_house_id, :integer
t.column :x_coordinate, :integer
t.column :y_coordinate, :integer
t.column :created_at, :datetime
t.column :updated_at, :datetime
... | Ruby |
class AddBasicRoles < ActiveRecord::Migration
def self.up
Role.delete_all
role = Role.new(:name => 'admin')
role.save
role = Role.new(:name => 'power_user')
role.save
role = Role.new(:name => 'guest')
role.save
end
def self.down
end
end
| Ruby |
class CreateRoleships < ActiveRecord::Migration
def self.up
create_table :roleships do |t|
t.column :user_id, :integer
t.column :role_id, :integer
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table :roleships
end
end
| Ruby |
# Copyright (c) 2008 [Sur http://expressica.com]
class CreateSimpleCaptchaData < ActiveRecord::Migration
def self.up
create_table :simple_captcha_data do |t|
t.column :key, :string, :limit => 40
t.column :value, :string, :limit => 6
t.column :created_at, :datetime
t.column :updated_at, :d... | Ruby |
class CreateReplies < ActiveRecord::Migration
def self.up
create_table :replies do |t|
t.column :name, :string
t.column :created_at, :datetime
t.column :content, :text
t.column :updated_at, :datetime
end
end
def self.down
drop_table :replies
end
end
| Ruby |
class CreateMovieHouses < ActiveRecord::Migration
def self.up
create_table :movie_houses do |t|
t.column :name, :string
t.column :seat_quantity, :integer
t.column :movie_house_state, :string
t.column :play_id, :integer
end
end
def self.down
drop_tabl... | Ruby |
class UpdateMoviesColumns < ActiveRecord::Migration
def self.up
add_column :movies, :time_period_on_show, :integer
remove_column :movies, :show_time
end
def self.down
end
end
| Ruby |
class CreateCinemas < ActiveRecord::Migration
def self.up
create_table :cinemas do |t|
t.column :name, :string
t.column :add, :string
t.column :employees, :integer
t.column :movie_house_quantity, :integer
t.column :phone... | Ruby |
class CreateMovies < ActiveRecord::Migration
def self.up
create_table :movies do |t|
t.column :name, :string
t.column :movie_genre, :string
t.column :show_status, :string
t.column :show_time, :datetime
t.column :cost, :decimal, :precision => 10, :scale... | Ruby |
class CreateMoviePics < ActiveRecord::Migration
def self.up
create_table :movie_pics do |t|
end
end
def self.down
drop_table :movie_pics
end
end
| Ruby |
class CreatePlaySets < ActiveRecord::Migration
def self.up
create_table :play_sets do |t|
t.column :play_id, :integer
t.column :set_id, :integer
t.column :state, :boolean
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
dr... | Ruby |
class AddMovieIdToReplies < ActiveRecord::Migration
def self.up
add_column :replies, :movie_id, :integer
end
def self.down
end
end
| Ruby |
class CreatePlays < ActiveRecord::Migration
def self.up
create_table :plays do |t|
t.column :movie_id, :integer
t.column :movie_house_id, :integer
t.column :play_time, :datetime
t.column :end_time, :datetime
end
end
def self.down
drop_table :plays
en... | Ruby |
class AddColumnsToMovieHouse < ActiveRecord::Migration
def self.up
add_column :movie_houses, :x_coordinate, :integer
add_column :movie_houses, :y_coordinate, :integer
end
def self.down
end
end
| Ruby |
class AddSessions < ActiveRecord::Migration
def self.up
create_table :sessions do |t|
t.column :session_id, :string
t.column :data, :text
t.column :updated_at, :datetime
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sess... | Ruby |
class UpdateColumnsOfPlaySets < ActiveRecord::Migration
def self.up
remove_column :play_sets, :set_id
add_column :play_sets, :movie_set_id, :integer
end
def self.down
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.column :name, :string
t.column :hashed_password, :string
t.column :role_id, :integer
t.column :salt, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
d... | Ruby |
class AddCinemaIdToUsers < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class AddRepliesData2 < ActiveRecord::Migration
def self.up
content = 'The first thing you?re going to need is the url of a server to connect to (and possibly a username & password). This document assumes that you already have a working Subversion server to connect to, and that you know the url for that repositor... | Ruby |
class AddColumnsToMoviePic < ActiveRecord::Migration
def self.up
add_column :movie_pics, :size, :integer # file size in bytes
add_column :movie_pics, :content_type, :string # mime type, ex: application/mp3
add_column :movie_pics, :filename, :string # sanitized filename
add_column :mov... | Ruby |
class AddRepliesData < ActiveRecord::Migration
def self.up
content = 'The first thing you?re going to need is the url of a server to connect to (and possibly a username & password). This document assumes that you already have a working Subversion server to connect to, and that you know the url for that repository... | Ruby |
class RemoveColumnsFromMovieHouse < ActiveRecord::Migration
def self.up
remove_column :movie_houses, :play_id
end
def self.down
end
end
| Ruby |
module AuthenticatedSystem
def admin?
for role in current_user.roles
user = :true if role.name == 'admin' && logged_in?
end
user
end
def power_user?
logged_in? && current_user.role.name == 'power_user'
end
def logged_in?
current_user != :false
end
def login_from... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the Fast... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the Fast... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.