code
stringlengths
1
1.73M
language
stringclasses
1 value
class CreateContracts < ActiveRecord::Migration def self.up create_table :contracts do |t| t.timestamps end end def self.down drop_table :contracts end end
Ruby
class CreateGameErrors < ActiveRecord::Migration def self.up create_table :game_errors do |t| t.timestamps end end def self.down drop_table :game_errors end end
Ruby
class CreateGames < ActiveRecord::Migration def self.up create_table :games do |t| t.timestamps end end def self.down drop_table :games end end
Ruby
class CreateGroups < ActiveRecord::Migration def self.up create_table :groups do |t| t.timestamps end end def self.down drop_table :groups end end
Ruby
class CreateTrades < ActiveRecord::Migration def self.up create_table :trades do |t| t.timestamps end end def self.down drop_table :trades end end
Ruby
class CreatePlayers < ActiveRecord::Migration def self.up create_table :players do |t| t.timestamps end end def self.down drop_table :players end end
Ruby
class CreateGameRunnings < ActiveRecord::Migration def self.up create_table :game_runnings do |t| t.timestamps end end def self.down drop_table :game_runnings end end
Ruby
class CreateFactories < ActiveRecord::Migration def self.up create_table :factories do |t| t.timestamps end end def self.down drop_table :factories end end
Ruby
class CreateAccounts < ActiveRecord::Migration def self.up create_table :accounts do |t| t.timestamps end end def self.down drop_table :accounts end end
Ruby
class CreateGameSettings < ActiveRecord::Migration def self.up create_table :game_settings do |t| t.timestamps end end def self.down drop_table :game_settings end end
Ruby
class CreatePlayerBalances < ActiveRecord::Migration def self.up create_table :player_balances do |t| t.timestamps end end def self.down drop_table :player_balances 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
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
module WelcomeHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def array_rank(arr) rank_array = arr ranks = (0..arr.length-1).to_a.sort_by{ |x| arr[x] } rank = 1 rank_array = Array.new ranks.each do |r| rank_array[r] = rank rank += 1 ...
Ruby
module GameSettingsHelper end
Ruby
module UserHelper end
Ruby
module FactoriesHelper end
Ruby
module PlayersHelper end
Ruby
module AccountHelper end
Ruby
module GameErrorsHelper end
Ruby
module GamesHelper end
Ruby
module WarehousesHelper end
Ruby
module AutoUsersHelper end
Ruby
module GameRunningsHelper end
Ruby
module PlayerBalancesHelper end
Ruby
module GroupsHelper end
Ruby
module MiscHelper end
Ruby
module RunningHelper end
Ruby
module DebtsHelper end
Ruby
class Account < ActiveRecord::Base end
Ruby
class Misc < ActiveRecord::Base end
Ruby
class PlayerBalance < ActiveRecord::Base belongs_to :player end
Ruby
class Player < ActiveRecord::Base belongs_to :game has_many :sales has_many :player_balances has_many :debts has_many :factories has_many :warehouses has_many :trades has_many :game_histories has_many :boards has_many :contracts end
Ruby
class GameRunning < ActiveRecord::Base end
Ruby
class Trade < ActiveRecord::Base belongs_to :game belongs_to :player end
Ruby
class Board < ActiveRecord::Base belongs_to :player end
Ruby
class Game < ActiveRecord::Base belongs_to :user has_many :players has_many :sales has_many :prices has_many :game_errors has_one :game_setting has_many :trades def player_list players = Player.find(:all, :conditions=>["game_id=?",self.id]) p_array = players.collect {|p| "#{p.name}: #{p.gencode...
Ruby
class User < ActiveRecord::Base has_many :games has_many :game_histories end
Ruby
class Contract < ActiveRecord::Base belongs_to :player end
Ruby
class GameError < ActiveRecord::Base belongs_to :game end
Ruby
class Factory < ActiveRecord::Base belongs_to :player end
Ruby
class Debt < ActiveRecord::Base belongs_to :player end
Ruby
class Warehouse < ActiveRecord::Base belongs_to :player end
Ruby
class Sale < ActiveRecord::Base belongs_to :player belongs_to :game end
Ruby
class Price < ActiveRecord::Base belongs_to :game end
Ruby
class AutoUser < ActiveRecord::Base set_table_name "users" end
Ruby
class Group < ActiveRecord::Base end
Ruby
class GameHistory < ActiveRecord::Base belongs_to :player belongs_to :user end
Ruby
class GameSetting < ActiveRecord::Base belongs_to :game end
Ruby
class DebtsController < ApplicationController end
Ruby
class UserController < ApplicationController include ActionView::Helpers::NumberHelper def do_login require "net/https" require 'json' require "uri" data = 'error' session[:user] = nil session[:user_data] = nil if !params[:uid].empty? begin url = "https://graph.facebook.com...
Ruby
class WarehousesController < ApplicationController end
Ruby
class PlayerBalancesController < ApplicationController end
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 helper :all # include all helpers, all the time #protect_from_forgery # See ActionController::RequestForgeryP...
Ruby
class WelcomeController < ApplicationController def index render :action=>"index", :layout=>"login_layout" end def index2 render :text=>"Under Construction!" end def rungroup require 'spreadsheet' book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet sheet1.name = 'Exported...
Ruby
class MiscController < ApplicationController def Misc end end
Ruby
class FactoriesController < ApplicationController end
Ruby
class AccountController < ApplicationController def Account end end
Ruby
class PlayersController < ApplicationController end
Ruby
class GamesController < ApplicationController layout "basic_layout" active_scaffold :game do |config| config.list.per_page = 20 config.columns = [:id, :gencode, :name, :a_player, :max_player, :min_price, :max_price, :min_error, :max_error, :min_sold, :max_sold, :user_id, :player_list] config.columns[:a_...
Ruby
class GameErrorsController < ApplicationController end
Ruby
class RunningController < ApplicationController include ActionView::Helpers::NumberHelper def is_game_open game = Game.find(session[:player].game_id) if session[:player].player_type=="B" if game.run_flag=='N' return true else word = 'คุณไม่สามารถดำเนินการระหว่างรอบการซื้อขายได้!!...
Ruby
class GameRunningsController < ApplicationController include ActionView::Helpers::NumberHelper def pre_gamepanel redirect_to :action=>"gamepanel", :gencode=>params[:gencode] end def futures_area render :action=>"futures_area", :layout=>false end def gamepanel_a @gencode = params[:gencode] ...
Ruby
class GameSettingsController < ApplicationController end
Ruby
class AutoUsersController < ApplicationController layout "basic_layout" before_filter :admin_required active_scaffold :auto_user do |config| config.list.per_page = 10 config.columns = [:id, :uid, :username, :password, :title, :firstname, :lastname, :admin_flag, :u_status] config.list.columns.exclude ...
Ruby
class GroupsController < ApplicationController 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 do debug a probl...
Ruby
if Rails.version == '2.3.8' && Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) && self.class.const_defined?(:Mongrel) # Pulled right from latest rack. Old looked like this in 1.1.0 version. # # def [](k) # super(@names[k] ||= @names[k.downcase]) # end # module Rack module Utils ...
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
# 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 atta...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :auto_users, :active_scaffold => true map.resources :warehouses map.resources :factories map.resources :debts map.resources :player_balances map.resources :players map.resources :groups map.resources :games, :active_scaffold => true # Th...
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.8' 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
# 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