code
stringlengths
1
1.73M
language
stringclasses
1 value
class RegiaoFuncoesController < CRUDController def buscar_funcao_da_pessoa_na_regiao respond_to do |format| format.amf do funcoes = RegiaoFuncao.find_all_by_regiao_id(params[0]) begin render :amf => funcoes rescue render :amf => FaultObject.new("Erro na busca de ...
Ruby
class CasaCongregacoesController < CRUDController def buscar_casas_congregacao_da_paroquia respond_to do |format| format.amf do casas = CasaCongregacao.find_all_by_paroquia_id(params[0]) begin render :amf => casas rescue render :amf => FaultObject.new("Erro na bu...
Ruby
class MovimentacoesController < CRUDController def listar_movimentos_pessoais respond_to do |format| format.amf do movimentacoes = Movimentacao.find_all_by_pessoa_id(params[0], :order => 'id DESC') begin render :amf => movimentacoes rescue render :amf => FaultObj...
Ruby
class CongregacoesController < CRUDController protected def classe Congregacao end end
Ruby
class MissasController < CRUDController def listar_missas_da_paroquia respond_to do |format| format.amf do missas = Missa.find_all_by_paroquia_id(params[0]) begin render :amf => missas rescue render :amf => FaultObject.new("Erro na busca de cadastro") end...
Ruby
class DizimosController < CRUDController def listar_dizimos_nao_efetivados respond_to do |format| format.amf do dizimos = Dizimo.find_all_by_dizimista_id(params[0], :order => "dataPagamento DESC") begin render :amf => dizimos rescue render :amf => FaultObject.new...
Ruby
class RegioesController < CRUDController def listar_regioes_da_diocese respond_to do |format| format.amf do regioes = Regiao.find_all_by_diocese_id(params[0]) begin render :amf => regioes rescue render :amf => FaultObject.new("Erro na busca de cadastro") ...
Ruby
class DiocesesController < CRUDController protected def classe Diocese end end
Ruby
class AuxiliarMovimentosController < CRUDController def buscar_formacao_pessoa respond_to do |format| format.amf do formacao = AuxiliarMovimento.find_by_pessoa_id(params[0]) begin unless formacao render :amf => FaultObject.new("Usuário sem formacao") else ...
Ruby
class ConselhosController < CRUDController protected def classe Conselho end end
Ruby
class TransferenciaContasController < CRUDController def gravar respond_to do |format| format.amf do transferencia = params[0] extrato_origem_ant = ExtratoConta.find_by_entidade_and_codigoEntidade_and_numeroConta(transferencia.entidade, transferencia.codigoEntidade, transferencia.contaOrige...
Ruby
class PaisesController < CRUDController protected def classe Pais end end
Ruby
class ImoveisController < CRUDController def listar_imoveis respond_to do |format| format.amf do imoveis = Imovel.find_all_by_entidade_and_codigo_entidade(params[0], params[1]) begin render :amf => imoveis rescue render :amf => FaultObject.new("Erro na busca de c...
Ruby
class ContatosController < CRUDController protected def classe Contato end end
Ruby
class RemessasController < CRUDController def listar_remessas_pendentes_a_cancelar respond_to do |format| format.amf do remessas = Remessa.find_all_by_entidadeOrigem_and_codigoEntidadeOrigem_and_origem_and_status(params[0], params[1], params[2], 'P') begin render :amf => remessas ...
Ruby
class GruposFinanceirosController < CRUDController def buscar_grupos_financeiros respond_to do |format| format.amf do grupos = GruposFinanceiro.find_all_by_entidade_and_codigoEntidade(params[0], params[1], :order => 'ordem ASC') begin render :amf => grupos rescue ...
Ruby
class RecibosController < CRUDController def listar_recibos_retroativos respond_to do |format| format.amf do recibos = Recibo.find_by_sql( "select * from recibos where entidade = '#{params[0]}' and codigoEntidade = #{pa...
Ruby
class CrismasController < CRUDController def listar_crismas_da_paroquia respond_to do |format| format.amf do crismas = Crisma.find_all_by_paroquia_id(params[0]) begin render :amf => crismas rescue render :amf => FaultObject.new("Erro na busca de cadastro") ...
Ruby
class PessoasController < CRUDController def filtrar_pessoas respond_to do |format| format.amf do lista = Pessoa.find_by_sql(Pessoa.carregar_consulta(params)) begin unless lista render :amf => FaultObject.new("Nenhum cadastro localizado") else ren...
Ruby
class SetorParoquiasController < CRUDController def buscar_setores_da_paroquia respond_to do |format| format.amf do setores = SetorParoquia.find_all_by_paroquia_id(params[0]) begin render :amf => setores rescue render :amf => FaultObject.new("Erro na busca de cad...
Ruby
class DizimistasController < CRUDController def listar_dizimistas_da_paroquia respond_to do |format| format.amf do dizimistas = Dizimista.find_all_by_paroquia_id(params[0]) begin render :amf => dizimistas rescue render :amf => FaultObject.new("Erro na busca de ca...
Ruby
class UsuariosController < CRUDController def buscar_usuario_por_pessoa respond_to do |format| format.amf do usuarios = Usuario.find_all_by_pessoa_id(params[0]) begin render :amf => usuarios rescue render :amf => FaultObject.new("Nenhum usuário listado") ...
Ruby
class LivrosController < CRUDController def listar_livros_da_paroquia respond_to do |format| format.amf do livros = Livro.find_all_by_paroquia_id(params[0]) begin render :amf => livros rescue render :amf => FaultObject.new("Erro na busca de cadastro") end...
Ruby
class BatismosController < CRUDController def listar_batismos_da_paroquia respond_to do |format| format.amf do batismos = Batismo.find_all_by_paroquia_id(params[0]) begin render :amf => batismos rescue render :amf => FaultObject.new("Erro na busca de cadastro") ...
Ruby
class TipoMovimentacoesController < CRUDController protected def classe TipoMovimentacao end end
Ruby
class ComunidadesController < CRUDController def buscar_comunidades_da_paroquia respond_to do |format| format.amf do comunidades = Comunidade.find_all_by_paroquia_id(params[0]) begin render :amf => comunidades rescue render :amf => FaultObject.new("Erro na busca ...
Ruby
class TipoSaidasController < CRUDController def buscar_tipo_de_saida respond_to do |format| format.amf do tipo = TipoSaida.find_by_id_and_entidade_and_codigoEntidade(params[0], params[1], params[2]) begin unless tipo render :amf => FaultObject.new("Tipo de saida não en...
Ruby
class TipoEntradasController < CRUDController def buscar_tipo_de_entrada respond_to do |format| format.amf do tipo = TipoEntrada.find_by_id_and_entidade_and_codigoEntidade(params[0], params[1], params[2]) begin unless tipo render :amf => FaultObject.new("Tipo de entrad...
Ruby
class ParoquiasController < CRUDController def listar_paroquias_da_regiao respond_to do |format| format.amf do paroquias = Paroquia.find_all_by_regiao_id(params[0]) begin render :amf => paroquias rescue render :amf => FaultObject.new("Erro na busca de cadastro") ...
Ruby
class GruposController < CRUDController protected def classe Grupo end end
Ruby
class TipoConselhosController < CRUDController protected def classe TipoConselho end 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, '\1\2en' inflect.singular /^(ox)en/i, '\1' inflect.irregular 'regiaoFuncao',...
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
# 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 Mime::Type.register "application/x-amf", :amf
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 :grupos_financeiros map.resources :crismas map.resources :saidas map.resources :tipo_saidas map.resources :entradas map.resources :tipo_entradas map.resources :ofertas map.resources :missas map.resources :dizimos map.resources :d...
Ruby
require 'app/configuration' module RubyAMF module Configuration #set the service path used in all requests # RubyAMF::App::RequestStore.service_path = File.expand_path(RAILS_ROOT) + '/app/controllers' # => CLASS MAPPING CONFIGURATION # => Global Property Ignoring # By putting attribute names...
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
namespace :importacao_sjt do task :cooperatores, :pasta, :entidade, :needs => :environment do |t, args| #comando: rake "importacao_sjt:cooperatores[D:\Dados]" separador = "," erros = '' args.with_defaults(:pasta => Dir.getwd, :entidade => :todas) puts " "; puts "Pasta adotada: #{a...
Ruby
namespace :importacao do task :cooperatores, :pasta, :entidade, :needs => :environment do |t, args| #comando: rake "importacao:cooperatores[D:\Dados]" separador = "|" args.with_defaults(:pasta => Dir.getwd, :entidade => :todas) puts " "; puts "Pasta adotada: #{args[:pasta]}" puts...
Ruby
namespace :importacao_p do task :cooperatores, :pasta, :entidade, :needs => :environment do |t, args| #comando: rake "importacao_p:cooperatores[D:\Dados]" separador = "," erros = '' args.with_defaults(:pasta => Dir.getwd, :entidade => :todas) puts " "; puts "Pasta adotada: #{args[...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
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 Product < ActiveRecord::Migration def self.up create_table :sessions do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at end def self.down drop_table :sessions end end
Ruby
class CreateProducts < ActiveRecord::Migration def self.up create_table :products do |t| t.string :title t.text :description t.string :image_url t.timestamps end end def self.down drop_table :products end end
Ruby
class CreateStudents < ActiveRecord::Migration def self.up create_table :students do |t| t.string :firstname t.string :lastname t.boolean :status t.timestamps end end def self.down drop_table :students end end
Ruby
class CreateCompanies < ActiveRecord::Migration def self.up create_table :companies do |t| t.string :name t.text :address t.string :sub_district t.string :district t.string :province t.string :zip_code t.string :tel t.string :fax t.string :email t.string...
Ruby
class CreateStudentEvaluationFirsts < ActiveRecord::Migration def self.up create_table :student_evaluation_firsts do |t| t.string :student_id t.string :employer_name t.string :evaluator_name t.string :evaluator_position t.string :evaluator_department t.timestamps end end...
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 AddTestData < ActiveRecord::Migration def self.up Product.delete_all Product.create(:title => 'Pragmatic Version Control', :description => %{This book is a recipe-based approach to using Subversion that will get you up.}, :image_url => '/images/svn.jpg', :price => 28.50) end def s...
Ruby
class CreateJobRequirements < ActiveRecord::Migration def self.up create_table :job_requirements do |t| t.string :position t.integer :amount t.text :job_specification t.integer :salary t.string :ext_welfare t.timestamps end end def self.down drop_table :job_requi...
Ruby
class CreateCompEvaluations < ActiveRecord::Migration def self.up create_table :comp_evaluations do |t| t.string :student_id t.string :student_name t.string :employer_name t.string :student_position t.string :student_department t.timestamps end end def self.down dr...
Ruby
class Student < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class CreateStudentEvaluationSeconds < ActiveRecord::Migration def self.up create_table :student_evaluation_seconds do |t| t.timestamps end end def self.down drop_table :student_evaluation_seconds end end
Ruby
class CreateEvaluationResultCamts < ActiveRecord::Migration def self.up create_table :evaluation_result_camts do |t| t.timestamps end end def self.down drop_table :evaluation_result_camts end end
Ruby
class CreateCountries < ActiveRecord::Migration def self.up create_table :countries do |t| t.column :iso, :string, :size => 2 t.column :name, :string, :size => 80 t.column :printable_name, :string, :size => 80 t.column :iso3, :string, :size => 3 t.column :numcode, :integer t.t...
Ruby
class CreateCompanyThs < ActiveRecord::Migration def self.up create_table :company_ths do |t| t.string :name t.string :address t.timestamps end end def self.down drop_table :company_ths end end
Ruby
class StudentStatus < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class CreateStudentThs < ActiveRecord::Migration def self.up create_table :student_ths do |t| t.string :firstname t.string :lastname t.timestamps end end def self.down drop_table :student_ths 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', '3.0.5' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Use unicorn as the web server # gem 'unicorn' # Deploy with Capistrano # gem 'capistrano' # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1....
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 StudentEvaluationFirstsHelper end
Ruby
module ApplicationHelper end
Ruby
module StudentStatusHelper end
Ruby
module StoreHelper end
Ruby
module CompanyTHsHelper end
Ruby
module StudentsHelper end
Ruby
module StudentEvaluationSecondsHelper end
Ruby
module EvaluationResultCamtsHelper end
Ruby
module UsersHelper end
Ruby
module ProductsHelper end
Ruby
module AdminHelper end
Ruby
module CamtsHelper end
Ruby
module StudentTHsHelper end
Ruby
module CompEvaluationsHelper end
Ruby
module CompaniesHelper end
Ruby
module JobRequirementsHelper end
Ruby
class JobRequirement < ActiveRecord::Base end
Ruby
class EvaluationResultCamt < ActiveRecord::Base end
Ruby
class StudentTh < ActiveRecord::Base end
Ruby
class Student < ActiveRecord::Base validates_presence_of :firstname, :lastname, :firstname_th, :lastname_th, :status, :advisor, :nationality,:email, :emergency_contact_name, :computer_language, :dob, :emergency_contact_relationship,:emergency_email, :emergency_phone, :father_name, :gpa, :id_card_no, :language_eng...
Ruby
class Product < ActiveRecord::Base validates_presence_of :title, :description, :image_url validates_numericality_of :price validate :price_must_be_at_least_a_cent validates_uniqueness_of :title validates_format_of :image_url, :with => %r{\.(gif|jpg|png|jpeg)$}i, :me...
Ruby
class StudentEvaluationFirst < ActiveRecord::Base validates_presence_of :evaluator_name, :evaluator_position, :evaluator_department, :quantity_of_work, :quality_of_work, :academic_ability, :ability_to_learn, :practical_ability, :judgment, :management, :communication, :foreign_language, :suitability, :responsibil...
Ruby
class CompEvaluation < ActiveRecord::Base end
Ruby
class CompanyTh < ActiveRecord::Base end
Ruby
#--- # Excerpted from "Agile Web Development with Rails, 3rd Ed.", # 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 pur...
Ruby