code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class OriginalTypesController < ApplicationController
# GET /original_types
# GET /original_types.xml
def index
@original_types = OriginalType.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @original_types }
end
end
# GET /original_types/1
# GE... | Ruby |
class CartsController < ApplicationController
# GET /carts
# GET /carts.xml
def index
@carts = Cart.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @carts }
end
end
# GET /carts/1
# GET /carts/1.xml
def show
@cart = Cart.find(params[:id])
... | Ruby |
class SuppliersController < ApplicationController
before_filter :authorize_show, :only => [ :index ]
def index
end
def show
@supplier = Supplier.find(params[:id])
respond_to do |format|
format.html
end
end
def new
@supplier = Supplier.new
respond_to do |format|
f... | Ruby |
class GearboxTypesController < ApplicationController
# GET /gearbox_types
# GET /gearbox_types.xml
def index
@gearbox_types = GearboxType.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @gearbox_types }
end
end
# GET /gearbox_types/1
# GET /gear... | Ruby |
class EngineTypesController < ApplicationController
# GET /engine_types
# GET /engine_types.xml
def index
@engine_types = EngineType.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @engine_types }
end
end
# GET /engine_types/1
# GET /engine_type... | Ruby |
class UsersController < ApplicationController
def new
@user = User.new
@cities = City.find(:all, :order => :name)
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to root_url, :notice => "Signed up!"
else
render "new"
end
end
end
| Ruby |
class CitiesController < ApplicationController
# GET /cities
# GET /cities.xml
def index
@cities = City.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @cities }
end
end
# GET /cities/1
# GET /cities/1.xml
def show
@city = City.find(params... | Ruby |
class UsedTypesController < ApplicationController
# GET /used_types
# GET /used_types.xml
def index
@used_types = UsedType.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @used_types }
end
end
# GET /used_types/1
# GET /used_types/1.xml
def sh... | Ruby |
class RegionsController < ApplicationController
# GET /regions
# GET /regions.xml
def index
@regions = Region.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @regions }
end
end
# GET /regions/1
# GET /regions/1.xml
def show
@region = Regio... | Ruby |
source 'http://rubygems.org'
gem 'rails', '3.0.10'
gem 'jquery-rails', '>= 1.0.12'
gem 'rails3-jquery-autocomplete'
gem 'formtastic', '~> 1.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'jrails'
gem "bcrypt-ruby", :require => "bcrypt"
# Use unicorn a... | 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 |
# 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 =>... | Ruby |
class RemoveIsUsedFromPartConfigurations < ActiveRecord::Migration
def self.up
remove_column :part_configurations, :is_used
end
def self.down
add_column :part_configurations, :is_used, :boolean
end
end
| Ruby |
class CreateCityRequests < ActiveRecord::Migration
def self.up
create_table :city_requests do |t|
t.integer :city_id
t.integer :request_id
t.timestamps
end
end
def self.down
drop_table :city_requests
end
end
| Ruby |
class CreateFilters < ActiveRecord::Migration
def self.up
create_table :filters do |t|
t.integer :supplier_id
t.integer :car_brand_id
t.integer :car_model_id
t.integer :year
t.integer :engine_type_id
t.integer :gearbox_type_id
t.timestamps
end
end
def self.down
... | Ruby |
class AddEmailToAdminUser < ActiveRecord::Migration
def self.up
add_column :admin_users, :email, :string
end
def self.down
remove_column :admin_users, :email
end
end
| Ruby |
class CreateEngineTypes < ActiveRecord::Migration
def self.up
create_table :engine_types do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :engine_types
end
end
| Ruby |
class CreateAdminUsers < ActiveRecord::Migration
def self.up
create_table :admin_users do |t|
t.string :password_hash
t.string :password_salt
t.timestamps
end
end
def self.down
drop_table :admin_users
end
end
| Ruby |
class CreateCarBrands < ActiveRecord::Migration
def self.up
create_table :car_brands do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :car_brands
end
end
| Ruby |
class RemoveIsOriginalFromPartConfigurations < ActiveRecord::Migration
def self.up
remove_column :part_configurations, :is_original
end
def self.down
add_column :part_configurations, :is_original, :boolean
end
end
| Ruby |
class AddRequestIdToCarts < ActiveRecord::Migration
def self.up
add_column :carts, :request_id, :integer
end
def self.down
remove_column :carts, :request_id
end
end
| Ruby |
class CreateCarts < ActiveRecord::Migration
def self.up
create_table :carts do |t|
t.timestamps
end
end
def self.down
drop_table :carts
end
end
| Ruby |
class RemovePartsGroupIdFromRequest < ActiveRecord::Migration
def self.up
remove_column :requests, :parts_group_id
end
def self.down
add_column :requests, :parts_group_id, :integer
end
end
| Ruby |
class CreateRequests < ActiveRecord::Migration
def self.up
create_table :requests do |t|
t.integer :car_brand_id
t.integer :car_model_id
t.integer :year
t.integer :engine_type_id
t.integer :gearbox_type_id
t.integer :parts_group_id
t.integer :part_id
t.string :gsm
... | Ruby |
class CreateGearboxTypes < ActiveRecord::Migration
def self.up
create_table :gearbox_types do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :gearbox_types
end
end
| Ruby |
class CreateCarModels < ActiveRecord::Migration
def self.up
create_table :car_models do |t|
t.integer :car_brand_id
t.string :name
t.timestamps
end
end
def self.down
drop_table :car_models
end
end
| Ruby |
class CreateSuppliers < ActiveRecord::Migration
def self.up
create_table :suppliers do |t|
t.string :email
t.string :password_hash
t.string :password_salt
t.timestamps
end
end
def self.down
drop_table :suppliers
end
end
| Ruby |
class AddUsedTypeAndOriginalTypeToPartConfigurations < ActiveRecord::Migration
def self.up
add_column :part_configurations, :used_type_id, :integer
add_column :part_configurations, :original_type_id, :integer
end
def self.down
remove_column :part_configurations, :original_type_id
remove_column :p... | Ruby |
class CreateParts < ActiveRecord::Migration
def self.up
create_table :parts do |t|
t.integer :parts_group_id
t.string :name
t.timestamps
end
end
def self.down
drop_table :parts
end
end
| Ruby |
class CreateRegionRequests < ActiveRecord::Migration
def self.up
create_table :region_requests do |t|
t.integer :region_id
t.integer :request_id
t.timestamps
end
end
def self.down
drop_table :region_requests
end
end
| Ruby |
class CreateOriginalTypes < ActiveRecord::Migration
def self.up
create_table :original_types do |t|
t.string :name
t.boolean :is_active
t.timestamps
end
end
def self.down
drop_table :original_types
end
end
| Ruby |
class CreatePartsGroups < ActiveRecord::Migration
def self.up
create_table :parts_groups do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :parts_groups
end
end
| Ruby |
class RemovePartIdFromRequest < ActiveRecord::Migration
def self.up
remove_column :requests, :part_id
end
def self.down
add_column :requests, :part_id, :integer
end
end
| Ruby |
class CreateUsedTypes < ActiveRecord::Migration
def self.up
create_table :used_types do |t|
t.string :name
t.boolean :is_active
t.timestamps
end
end
def self.down
drop_table :used_types
end
end
| Ruby |
class AddPartsGroupIdToFilters < ActiveRecord::Migration
def self.up
add_column :filters, :parts_group_id, :integer
end
def self.down
remove_column :filters, :parts_group_id
end
end
| Ruby |
class CreatePartConfigurations < ActiveRecord::Migration
def self.up
create_table :part_configurations do |t|
t.integer :part_id
t.integer :parts_group_id
t.string :part_name
t.boolean :is_used
t.boolean :is_original
t.timestamps
end
end
def self.down
drop_table :... | Ruby |
class CreateRegions < ActiveRecord::Migration
def self.up
create_table :regions do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :regions
end
end
| Ruby |
class AddRegionIdToCities < ActiveRecord::Migration
def self.up
add_column :cities, :region_id, :integer
end
def self.down
remove_column :cities, :region_id
end
end
| Ruby |
class AddIsAuthorizedToRequests < ActiveRecord::Migration
def self.up
add_column :requests, :is_authorized, :boolean
end
def self.down
remove_column :requests, :is_authorized
end
end
| Ruby |
class AddCartIdToPartConfigurations < ActiveRecord::Migration
def self.up
add_column :part_configurations, :cart_id, :integer
end
def self.down
remove_column :part_configurations, :cart_id
end
end
| Ruby |
class RemoveOffersCityIdFromRequests < ActiveRecord::Migration
def self.up
remove_column :requests, :offers_city_id
end
def self.down
add_column :requests, :offers_city_id, :integer
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :email
t.string :gsm
t.integer :city_id
t.string :password_hash
t.string :password_salt
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateCities < ActiveRecord::Migration
def self.up
create_table :cities do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :cities
end
end
| Ruby |
class RenameFiltersYear < ActiveRecord::Migration
def self.up
rename_column :filters, :year, :start_year
end
def self.down
rename_column :filters, :start_year, :year
end
end
| Ruby |
class AddEndYearToFilters < ActiveRecord::Migration
def self.up
add_column :filters, :end_year, :integer
end
def self.down
remove_column :filters, :end_year
end
end
| Ruby |
class AddCartIdToRequest < ActiveRecord::Migration
def self.up
add_column :requests, :cart_id, :integer
end
def self.down
remove_column :requests, :cart_id
end
end
| Ruby |
class CreateCars < ActiveRecord::Migration
def self.up
create_table :cars do |t|
t.integer :user_id
t.integer :car_brand_id
t.integer :car_model_id
t.integer :year
t.integer :engine_type_id
t.integer :gearbox_type_id
t.timestamps
end
end
def self.down
drop_t... | 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.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'rake'
TestApp::Application.load_tasks
| Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run TestApp::Application
| Ruby |
TestApp::Application.routes.draw do
get "suppliers/login"
get "suppliers/filters"
get "suppliers/login" => "suppliers#login", :as => "suppliers_login"
get "suppliers/logout" => "suppliers#logout", :as => "suppliers_logout"
post "suppliers/do_login"
post "suppliers/add_filter"
match 'suppliers/updat... | Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module TestApp
class Application < Rails::Application
#... | Ruby |
TestApp::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 webse... | Ruby |
TestApp::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 ... | Ruby |
TestApp::Application.configure do
# Settings specified here will take precedence over those in config/application.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... | 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 |
# 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.
TestApp::Application.config.session_store :cookie_store, :key => '_test_app_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 "rai... | 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 |
# encoding: utf-8
# --------------------------------------------------------------------------------------------------
# Please note: If you're subclassing Formtastic::SemanticFormBuilder in a Rails 3 project,
# Formtastic uses class_attribute for these configuration attributes instead of the deprecated
# class_inhe... | 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.
# 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 |
# Load the rails application
require File.expand_path('../application', __FILE__)
ActionView::Base.field_error_proc = proc { |input, instance| input }
# Initialize the rails application
TestApp::Application.initialize!
| 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.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use yo... | 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.
Cars::Application.config.session_store :cookie_store, :key => '_cars_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 "rails gene... | 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 |
Cars::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.action_co... | Ruby |
Cars::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 ... | Ruby |
Cars::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 suite... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Cars::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 |
Cars::Application.routes.draw do
devise_for :users
get "brands/new"
resources :models
resources :brands
root :to => 'pages#index'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep i... | Ruby |
module ApplicationHelper
end
| Ruby |
module BrandsHelper
end
| Ruby |
module PagesHelper
end
| Ruby |
class Brand < ActiveRecord::Base
attr_accessible :idModel, :name
end
| Ruby |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or pr... | Ruby |
class Model < ActiveRecord::Base
attr_accessible :color, :engine, :idComment, :idStatus, :licensePlate, :name, :power, :productionYear, :vin, :note
end
| Ruby |
class BrandsController < ApplicationController
#@brand = ""
#@model = ""
#@productionYear = 0
#@engine = 0
#@currentStatus = 0
#@vin = ""
#@licensePlate = ""
#@color = ""
def new
# @productionYear = ""
#@brand = params[:brand]
#@model = params[:model]
#@productionYear = params[:production... | Ruby |
class PagesController < ApplicationController
def index
end
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| 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__)
Cars::Application.load_tasks
| 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__)
Cars::Application.load_tasks
| Ruby |
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'json'
gem 'devise'
# Gems used only for assets and not required
# in production environments by default.
group ... | Ruby |
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_to... | Ruby |
class CreateModels < ActiveRecord::Migration
def change
create_table :models do |t|
t.string :name
t.integer :productionYear
t.string :engine
t.integer :power
t.integer :idStatus
t.string :vin
t.string :licensePlate
t.string :color
t.integer :idComment
t... | Ruby |
class CreateBrands < ActiveRecord::Migration
def change
create_table :brands do |t|
t.string :name
t.integer :idModel
t.timestamps
end
end
end
| 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 =>... | Ruby |
class AddNoteToModels < ActiveRecord::Migration
def change
add_column :models, :note, :string
end
end
| Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Cars::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 |
module Jekyll
module BugFilter
def bugify(input)
upstream_map = {
"Bootstrap" => "https://github.com/twbs/bootstrap/issues/",
"IE" => ["https://connect.microsoft.com/IE/feedback/details/", "IE bug"],
"Mozilla" => ["https://bugzilla.mozilla.org/show_bug.cgi?id=", "Mozilla bug"],
... | Ruby |
require 'yaml'
module Bridge
class Generator < Jekyll::Generator
def generate(site)
site.data["configBridge"] = YAML.load_file("./grunt/configBridge.json")
end
end
end | Ruby |
# desc "Explaining what the task does"
# task :automator do
# # Task goes here
# end | Ruby |
class WorkflowActionGenerator < Rails::Generator::NamedBase
attr_accessor :input_classes, :output_class
def initialize(*runtime_args)
super(*runtime_args)
for arg in args
if arg.index(':')
field, value = arg.split(':')
case field
when 'input_classes'
@input_classes... | Ruby |
class <%= file_name.camelize %> < WorkflowAction
def valid_input_classes
[<%= input_classes %>]
end
def output_class
<%= output_class %>
end
def execute
# @output = your output here
end
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.