code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class CreateTickets < ActiveRecord::Migration
def self.up
create_table :tickets do |t|
t.integer :tracker_id
#current holders, actions
t.timestamps
end
end
def self.down
drop_table :tickets
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string "username", :default => "", :null => false
t.string "password_hash", :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "email", :default => ... | Ruby |
class CreateProtectables < ActiveRecord::Migration
def self.up
create_table :protectables do |t|
t.integer :tracker_id
t.integer :ticket_id
t.integer :field_id
t.string :action_id
t.string :options #other access methods?
t.timestamps
end
end
def self.down
drop... | Ruby |
class CreateRoles < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.timestamps
end
end
def self.down
drop_table :roles
end
end
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::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 da... | 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 |
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
require 'openid/store/filesystem'
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it... | 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 the integrity of signed cookies.
# If you change this key, all old signed cookies 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 attac... | Ruby |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# Be sure to restart your server when you modify this file.
Cobraseries::Application.config.session_store :cookie_store, key: '_cobraseries_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with ... | 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 to debug a probl... | Ruby |
Cobraseries::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.ac... | Ruby |
Cobraseries::Application.configure do
# Settings specified here will take precedence over those in config/application.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 w... | Ruby |
Cobraseries::Application.configure do
# Settings specified here will take precedence over those in config/application.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 t... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Cobraseries::Application.initialize!
| Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
Cobraseries::Application.routes.draw do
#devise_for :users
get 'admin' => 'admin#index'
controller :sessions do
get 'login' => :new
post 'login' => :create
delete 'logout' => :destroy
end
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :user... | Ruby |
module AdminHelper
end
| Ruby |
module ApplicationHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module SessionsHelper
end
| Ruby |
module VideoCatalogHelper
end
| Ruby |
module ProductsHelper
end
| Ruby |
module VideoProductsHelper
end
| Ruby |
module SayHelper
end
| Ruby |
class VideoProduct < ActiveRecord::Base
#default_scope :order => 'title'
#named_scope :order => 'nr_views DESC'
end
| Ruby |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable
... | Ruby |
class Product < ActiveRecord::Base
end
| Ruby |
class ProductsController < ApplicationController
# GET /products
# GET /products.json
def index
@products = Product.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @products }
end
end
# GET /products/1
# GET /products/1.json
def show
@produc... | Ruby |
class VideoCatalogController < ApplicationController
def index
@video_products = VideoProduct.order('title ASC')
end
def popularity_all
@video_products = VideoProduct.order('nr_views DESC')
end
def release_date_all
@video_products = VideoProduct.order('release_date DESC')
end
def added_date_al... | Ruby |
class SayController < ApplicationController
def CU
@files = Dir.glob('*')
end
def SARBATORILE
@time = Time.now
end
end
| Ruby |
class AdminController < ApplicationController
def index
end
end
| Ruby |
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model
@user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success",... | Ruby |
class VideoProductsController < ApplicationController
# GET /video_products
# GET /video_products.json
def index
@video_products = VideoProduct.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @video_products }
end
end
# GET /video_products/1
# GET... | Ruby |
class SessionsController < ApplicationController
def new
end
def create
if user = User.authenticate(params[:name], params[:password])
session[:user_id] = user.id
redirect_to video_catalog_index_path
else
redirect_to login_url, :alert => "Invalid user/password combination"
end
end
... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
class UsersController < ApplicationController
# GET /users
# GET /users.json
def index
@users = User.order(:name)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
# GET /users/1
# GET /users/1.json
def show
@user = User.find(par... | Ruby |
#!/usr/bin/env rake
# 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.expand_path('../config/application', __FILE__)
Cobraseries::Application.load_tasks
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
#!/usr/bin/env rake
# 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.expand_path('../config/application', __FILE__)
Cobraseries::Application.load_tasks
| Ruby |
source 'http://rubygems.org'
gem 'rails', '3.1.3'
#gem 'devise', '1.5.3'
gem "devise", :git => "https://github.com/plataformatec/devise.git"
gem "omniauth"
gem 'omniauth-facebook'
gem 'omniauth-openid'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems ... | Ruby |
class AddDeviseToUsers < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy =... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name
t.string :hashed_password
t.string :salt
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class AddDeviseToUsers2 < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
#t.database_authenticatable :null => false
#t.recoverable
#t.rememberable
#t.trackable
# t.encryptable
t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strate... | Ruby |
class CreateVideoProducts < ActiveRecord::Migration
def self.up
create_table :video_products do |t|
t.string :title
t.date :release_date
t.date :added_date
t.string :imdb_id
t.integer :nr_views
t.timestamps
end
end
def self.down
drop_table :video_products
end
end... | Ruby |
#---
# Excerpted from "Agile Web Development with Rails",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# ... | Ruby |
class CreateVideoProducts < ActiveRecord::Migration
def self.up
create_table :video_products do |t|
t.string :title
t.date :release_date
t.date :added_date
t.string :imdb_id
t.integer :nr_views
t.timestamps
end
end
def self.down
drop_table :video_products
... | Ruby |
class CreateProductsNew < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.string :title
t.text :description
t.string :image_url
t.decimal :price, :precision => 8, :scale => 2
t.timestamps
end
end
def self.down
drop_table :products
end
end
| Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Cobraseries::Application
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integrati... | Ruby |
require 'rubygems'
require '/opt/local/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/CocoaMagick.rb'
#require 'RMagick'
require File.dirname(__FILE__) + '/deprecated'
##
# = Gruff. Graphs.
#
# Author:: Geoffrey Grosenbach boss@topfunky.com
#
# Originally Created:: October 23, 2005
#
# Extra thanks to Tim Hunter for wr... | Ruby |
# CocoaMagick.rb
# Tim Burks / RubyCocoa Resources http://www.rubycocoa.com
#
# This is a quick-and-dirty replacement for RMagic written specifically
# for Geoffrey Grosenbach's "gruff" graphing package.
# It uses RubyCocoa and the Cocoa API to draw the elements of gruff graphs.
# It is FAR from comprehensive, but w... | Ruby |
environment = :production
project_type = :stand_alone
http_path = "/"
css_dir = "../styles"
sass_dir = "."
images_dir = "images"
sass_options = {
:line_numbers => false,
:debug_info => false
}
# output_style = :compressed
# output_style = :compact
output_style = :expanded
| Ruby |
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => 2010,
:DocumentRoot => Dir::pwd
)
s.mount('/sh/scripts', WEBrick::HTTPServlet::FileHandler, '../scripts')
s.mount('/sh/styles', WEBrick::HTTPServlet::FileHandler, '../styles')
trap('INT') { s.stop }
s.start
| Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | Ruby |
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :name
t.string :description
t.string :history
t.integer :quantity
t.decimal :cockpitCost
t.decimal :sellerCost
t.timestamps
end
end
end
| Ruby |
class CreateImages < ActiveRecord::Migration
def change
create_table :images do |t|
t.string :name
t.string :path
t.integer :product_id
t.timestamps
end
end
end
| Ruby |
class AddAvatarToImages < ActiveRecord::Migration
def change
add_column :images, :avatar, :string
end
end
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integrati... | Ruby |
#!/usr/bin/env rake
# 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.expand_path('../config/application', __FILE__)
Dreamthings::Application.load_tasks
| Ruby |
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3... | Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
module ApplicationHelper
end
| Ruby |
module ImagesHelper
end
| Ruby |
module ProductsHelper
end
| Ruby |
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
# include Sprockets::Helpers::RailsHelper
# include S... | Ruby |
class Product < ActiveRecord::Base
attr_accessible :cockpitCost, :description, :history, :name, :quantity, :sellerCost
has_many :images
end
| Ruby |
class Image < ActiveRecord::Base
attr_accessible :name, :path, :product_id , :avatar
belongs_to :product
mount_uploader :avatar, AvatarUploader
end
| Ruby |
class ImagesController < ApplicationController
# GET /images
# GET /images.json
def index
@images = Image.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @images }
end
end
# GET /images/1
# GET /images/1.json
def show
@image = Image.find(par... | Ruby |
class ProductsController < ApplicationController
# GET /products
# GET /products.json
def index
@products = Product.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @products }
end
end
# GET /products/1
# GET /products/1.json
def show
@produc... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| 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 to debug a probl... | Ruby |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies 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 attac... | 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.
Dreamthings::Application.config.session_store :cookie_store, key: '_dreamthings_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with ... | Ruby |
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'AKIAJPESCLIRTTE5MOWQ', # required
:aws_secret_access_key => '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', ... | Ruby |
Dreamthings::Application.routes.draw do
devise_for :users
resources :categories
resources :images
resources :products do
resources :images
end
#root :to => "products/"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match ... | Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dreamthings::Application.initialize!
| Ruby |
Dreamthings::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.ac... | Ruby |
Dreamthings::Application.configure do
# Settings specified here will take precedence over those in config/application.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 we... | Ruby |
Dreamthings::Application.configure do
# Settings specified here will take precedence over those in config/application.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 tes... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Dreamthings::Application
| Ruby |
#!/usr/bin/env rake
# 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.expand_path('../config/application', __FILE__)
Dreamthings::Application.load_tasks
| Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | Ruby |
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | Ruby |
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | Ruby |
# Be sure to restart your server when you modify this file.
Blog::Application.config.session_store :cookie_store, key: '_blog_session'
| Ruby |
Blog::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers... | Ruby |
Blog::Application.configure do
# Settings specified here will take precedence over those in config/application.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 web serv... | Ruby |
Blog::Application.configure do
# Settings specified here will take precedence over those in config/application.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 suit... | Ruby |
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Blog::Application.initialize!
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.