code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class Admin::ForumsController < Admin::AuthenticatedController
def index
@forums = Forum.all
end
def show
@forum = Forum.find(params[:id])
end
def new
@forum = Forum.new
end
def create
@forum = Forum.new(params[:forum])
if @forum.save
redirect_to @forum, :notice => "Successful... | Ruby |
#encoding: UTF-8
class HistoriaController < ApplicationController
def index
@page_title = 'Nuestra historia'
end
end | Ruby |
class TopicsController < ApplicationController
def index
@topics = Topic.all
end
def show
@topic = Topic.find(params[:id])
end
def new
@topic = Topic.new
@post = Post.new
end
def create
@topic = Topic.new(params[:topic])
@post = Post.new
if @topic.save
@topic = Topic... | Ruby |
class PasswordResetInstructionsController < ApplicationController
before_filter :load_user_using_perishable_token, :only => [:edit, :update]
before_filter :require_no_user
def new
@page_title = 'Forgot password'
end
def create
@user = User.find_by_email(params[:email])
if @user
@us... | Ruby |
# encoding: UTF-8
class CheckoutController < ApplicationController
before_filter :initialize_cart, :only => :index
def index
@order = Order.new
@page_title = 'Realizar pedido'
if @cart.productos.empty?
flash[:notice] = 'Tu carrito de la compra esta vacio! ' +
'Po... | Ruby |
class ForumsController < ApplicationController
def index
@forums = Forum.all
end
def show
@forum = Forum.find(params[:id])
end
def new
@forum = Forum.new
end
def create
@forum = Forum.new(params[:forum])
if @forum.save
redirect_to @forum, :notice => "Successfully created forum... | 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 |
require 'eu_central_bank'
| 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.
Campina::Application.config.session_store :cookie_store, key: '_campina_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 g... | Ruby |
require 'countries'
| Ruby |
require 'make_like_a_tree'
Julik::MakeLikeTree.bootstrap! | Ruby |
Campina::Application.routes.draw do
resources :posts
resources :topics
resources :forums
#get "historia/index"
#match 'forums', :controller => 'forums'
root :to => 'catalog#index'
match 'catalog' => 'catalog#index'
match 'about' => 'about#index'
match 'checkout' => 'checkout#index'
match 'ad... | 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
Campina::Application.initialize!
| Ruby |
Campina::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... | Ruby |
Campina::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 s... | Ruby |
Campina::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 su... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Campina::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__)
Campina::Application.load_tasks
| Ruby |
Reported by bXXX.rXXX@oXXX.com, Mar 11, 2011
I found the need to have a nice start / stop / restart wrapper for
shellinabox, and a quick way to add new configurations and URLS.
Attached is a file that does just that.
It is ruby based, and expects a conf directory in the shellinthebox
home directory. All file(s) plac... | Ruby |
#!/usr/bin/ruby
#===============================================================================
#
# FILE: siab.rb
#
# USAGE: ruby siab.rb [start|stop|restar|help]
#
# DESCRIPTION: a ShellInAbox control script and configuration system reader.
# To auto-configure a shellinabox service creat... | Ruby |
# encoding: UTF-8
# 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:
#
clubes = [
{:nome => "Milan"},
{:nome => "Real Madrid"},
{:nome => "Barcelona"... | Ruby |
class CreateParticipacoes < ActiveRecord::Migration
def self.up
create_table :participacoes do |t|
t.integer :jogador_id, :null => false
t.integer :clube_id, :null => false
t.timestamps
end
end
def self.down
drop_table :participacoes
end
end | Ruby |
class AddAttachmentFotoToJogador < ActiveRecord::Migration
def self.up
add_column :jogadores, :foto_file_name, :string
add_column :jogadores, :foto_content_type, :string
add_column :jogadores, :foto_file_size, :integer
add_column :jogadores, :foto_updated_at, :datetime
end
def self.down
remov... | Ruby |
class CreateHistoricos < ActiveRecord::Migration
def self.up
create_table :historicos_jogador_clube do |t|
t.integer :participacao_id, :null => false
t.integer :fregues_id
t.integer :rival_id
t.integer :gols_marcados, :null => false, :default => 0
t.integer :gols_sofridos, :null => f... | Ruby |
class CreateJogadores < ActiveRecord::Migration
def self.up
create_table :jogadores do |t|
t.string :nome, :null => false
# t.string :email, :null => false
# t.string :login, :null => false
# t.string :password_hash, :null => false
# t.string :password_salt, :null =>false
t.timesta... | Ruby |
class CreateCampeonatos < ActiveRecord::Migration
def self.up
create_table :campeonatos do |t|
t.string :nome
t.date :data
t.timestamps
end
add_column :partidas, :campeonato_id, :integer
end
def self.down
drop_table :campeonatos
remove_collumn :partidas, :campeonato_id
... | Ruby |
class CreatePartidas < ActiveRecord::Migration
def self.up
create_table :partidas do |t|
t.integer :participacao_1_id, :null => false
t.integer :participacao_2_id, :null => false
t.integer :gols_p1, :null => false
t.integer :gols_p2, :null => false
t.integer :total_chutes_p1, :null =... | Ruby |
class CreateHistoricosJogador < ActiveRecord::Migration
def self.up
create_table :historicos_jogador do |t|
t.integer :jogador_id, :null => false
t.integer :fregues_id
t.integer :rival_id
t.integer :gols_marcados, :null => false, :default => 0
t.integer :gols_sofridos, :null => false... | Ruby |
class CreateClubes < ActiveRecord::Migration
def self.up
create_table :clubes do |t|
t.string :nome, :null => false
t.timestamps
end
end
def self.down
drop_table :clubes
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 |
source 'http://rubygems.org'
gem 'rails'
gem 'brazilian-rails'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '0.2.7'
gem "jquery-rails"
gem "paperclip"
gem "bcrypt-ruby", :require => "bcrypt"
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capi... | 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 InscricoesCampeonatosHelper
end
| Ruby |
module PartidasHelper
end
| Ruby |
module TorneiosHelper
end
| Ruby |
module CampeonatosHelper
end
| Ruby |
module ParticipacoesEquipesHelper
end
| Ruby |
module ModalidadesHelper
end
| Ruby |
module PartidasEquipesHelper
end
| Ruby |
module PontuacoesTorneiosHelper
end
| Ruby |
module EquipesHelper
end
| Ruby |
module ConvitesHelper
end
| Ruby |
class HistoricoJogador < ActiveRecord::Base
belongs_to :jogador
scope :por_jogador_id, lambda { |jogador|
where(:jogador_id => jogador)
}
end
| Ruby |
class Clube < ActiveRecord::Base
has_many :participacoes
has_many :historicos_jogador_clube
end
| Ruby |
class PartidaObserver < ActiveRecord::Observer
observe :partida
def after_create(partida)
p1 = partida.participacao_1
p2 = partida.participacao_2
h = p1.historico_jogador_clube
h2 = p2.historico_jogador_clube
hj = HistoricoJogador.por_jogador_id(h.participacao.jogador_id).first
hj2 = Histor... | Ruby |
class Participacao < ActiveRecord::Base
belongs_to :jogador
belongs_to :clube
has_one :historico_jogador_clube
has_many :partidas
scope :por_jogador_id, lambda { |jogador|
where(:jogador_id => jogador)
}
scope :por_clube_id, lambda { |clube|
where(:clube_id => clube)
}
end
| Ruby |
class Jogador < ActiveRecord::Base
attr_accessible :nome, :email, :login, :password, :password_confirmation, :foto
attr_accessor :password
before_save :encrypt_password
has_many :historicos_jogador_clube
has_many :participacoes
has_attached_file :foto, :styles => { :grande => "300x300>", :miniat... | Ruby |
class SistemaId < ActiveRecord::Base
end
| Ruby |
class Campeonato < ActiveRecord::Base
has_many :partidas
end
| Ruby |
class HistoricoJogadorClube < ActiveRecord::Base
belongs_to :participacao
scope :por_clube_id, lambda { |clube|
joins(:participacao).where(:participacoes => {:clube_id => clube})
}
scope :por_jogador_id, lambda { |jogador|
joins(:participacao).where(:participacoes => {:jogador_id => jogador})
}
... | Ruby |
class Partida < ActiveRecord::Base
belongs_to :participacao_1, :class_name => "Participacao"
belongs_to :participacao_2, :class_name => "Participacao"
belongs_to :campeonato
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
# before_filter :usuario_requerido
private
def current_user
@current_user ||= Jogador.find(session[:user_id]) if session[:user_id]
end
def usuario_requerido
unless session[:user_id]
... | Ruby |
class ClubesController < ApplicationController
# GET /clubes
# GET /clubes.xml
def index
@clubes = Clube.all
end
# GET /clubes/1
# GET /clubes/1.xml
def show
@clube = Clube.find(params[:id])
end
# GET /clubes/new
# GET /clubes/new.xml
def new
@clube = Clube.new
end
# GET /clubes... | Ruby |
class SistemaIdController < ApplicationController
def index
end
end
| Ruby |
class PartidasController < ApplicationController
# GET /partidas
# GET /partidas.xml
def index
@partidas = Partida.all
end
# GET /partidas/1
# GET /partidas/1.xml
def show
@partida = Partida.find(params[:id])
end
# GET /partidas/new
# GET /partidas/new.xml
def new
@partida = Partid... | Ruby |
class ParticipacoesController < ApplicationController
def index
@participacoes = Participacao.all
end
def show
@participacao = Participacao.find(params[:id])
@historico = @participacao.historico_jogador_clube
end
end | Ruby |
class CampeonatosController < ApplicationController
def index
@campeonatos = Campeonato.all
end
# GET /campeonatos/1
# GET /campeonatos/1.xml
def show
@campeonato = Campeonato.find(params[:id])
end
# GET /campeonatos/new
# GET /campeonatos/new.xml
def new
@campeonato = Campeonato.new
... | Ruby |
class JogadoresController < ApplicationController
skip_before_filter :usuario_requerido, :only => ['new', 'create']
def index
@jogadores = Jogador.all
end
def new
@jogador = Jogador.new
end
def mostrar
@jogador = Jogador.find(params[:id])
@historico = HistoricoJogador.por_jogador_i... | Ruby |
class SessionsController < ApplicationController
skip_before_filter :usuario_requerido, :only => ['new', 'create']
def new
end
def create
user = Jogador.authenticate(params[:login], params[:password])
if user
session[:user_id] = user.id
redirect_to root_url, :notice => "Logado!"
else
flash.now.ale... | Ruby |
# encoding: UTF-8
# Be sure to restart your server when you modify this file.
ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.irregular 'inscricao_campeonato' , 'inscricoes_campeonat... | 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.
# 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.
ID::Application.config.session_store :cookie_store, :key => '_ID_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 generate... | Ruby |
ID::Application.routes.draw do
resources :partidas
match ':controller/:action', :action => /[a-z_]+/i
resources :sessions
root :to => "sistema_id#index"
get "log_out" => "sessions#destroy", :as => "log_out"
get "log_in" => "sessions#new", :as => "log_in"
###############################... | 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'])
require 'yaml'
YAML::ENGINE.yamler= 'syck'
| 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 ID
class Application < Rails::Application
# Sett... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
ID::Application.initialize!
| Ruby |
ID::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
co... | Ruby |
ID::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 webserver ... | Ruby |
ID::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 |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run ID::Application
| 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'
ID::Application.load_tasks
| 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):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# 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.
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
# Store the full class name (including module namespa... | 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 |
# 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
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | 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
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1... | 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|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
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
# See ActionController::RequestForgeryProtection for details... | 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/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.