code
stringlengths
1
1.73M
language
stringclasses
1 value
class CreateSucursales < ActiveRecord::Migration def self.up create_table :sucursales do |t| t.string :nombre t.string :codigo t.string :direccion t.string :telefono t.references :empresa t.timestamps end add_index :sucursales, :empresa_id end def self.down dr...
Ruby
class CreateHechos < ActiveRecord::Migration def self.up create_table :hechos do |t| t.string :nombre t.string :descripcion t.integer :puntos t.timestamps end end def self.down drop_table :hechos end end
Ruby
class RemoveNivelFromCargo < ActiveRecord::Migration def self.up remove_column :cargos, :nivel end def self.down add_column :cargos, :nivel, :string end end
Ruby
class AddIvaAguinaldoToUsuario < ActiveRecord::Migration def self.up add_column :usuarios, :iva_aguinaldo, :bool end def self.down remove_column :usuarios, :iva_aguinaldo end end
Ruby
class CreateIdiomas < ActiveRecord::Migration def self.up create_table :idiomas do |t| t.string :nombre t.timestamps end end def self.down drop_table :idiomas end end
Ruby
class CreateAreas < ActiveRecord::Migration def self.up create_table :areas do |t| t.string :nombre t.timestamps end end def self.down drop_table :areas end end
Ruby
class CreateHijos < ActiveRecord::Migration def self.up create_table :hijos do |t| t.string :nombre t.string :sexo t.string :nacionalidad t.string :nivel t.references :usuario t.timestamps end end def self.down drop_table :hijos end end
Ruby
class CreateNiveles < ActiveRecord::Migration def self.up create_table :niveles do |t| t.string :nombre t.integer :desde t.integer :hasta t.timestamps end end def self.down drop_table :niveles end end
Ruby
class AddPuntuacionRegistradaToIncidente < ActiveRecord::Migration def self.up add_column :incidentes, :puntuacion_registrada, :decimal,:default=>nil,:scale=>2,:precision=>8 end def self.down remove_column :incidentes,:puntuacion_registrada end end
Ruby
class AddNoConformidadToIncidentes < ActiveRecord::Migration def self.up add_column :incidentes, :no_conformidad, :integer end def self.down remove_column :incidentes, :no_conformidad end end
Ruby
class CreateHobbies < ActiveRecord::Migration def self.up create_table :hobbies do |t| t.string :nombre t.text :descripcion t.timestamps end #Crear realacion HABTM create_table :hobbies_usuarios, :id => false do |t| t.integer :hobbie_id, :usuario_id end end def self.d...
Ruby
class CreateAutorizaciones < ActiveRecord::Migration def self.up create_table :autorizaciones do |t| t.integer :usuario_id t.integer :responsable_id t.date :fecha t.time :entrada t.time :salida t.integer :horas t.text :motivo t.timestamps end end def self....
Ruby
class CreateModulos < ActiveRecord::Migration def self.up create_table :modulos do |t| t.string :nombre t.string :descripcion t.timestamps end end def self.down drop_table :modulos end end
Ruby
class CreateCompetencias < ActiveRecord::Migration def self.up create_table :competencias do |t| t.string :titulo t.text :descripcion t.integer :junior t.integer :senior t.integer :master t.decimal :peso t.timestamps end end def self.down drop...
Ruby
class AddRecibeMailsHechosToCargo < ActiveRecord::Migration def self.up add_column :cargos, :recibe_mails_hechos, :boolean end def self.down remove_column :cargos, :recibe_mails_hechos end end
Ruby
class CreatePredefinidos < ActiveRecord::Migration def self.up create_table :predefinidos do |t| t.integer :tipo t.references :tipo_movimiento t.decimal :valor, :precision => 12, :scale => 2 t.timestamps end create_table :predefinidos_usuarios, :id => false do |t| t.integer ...
Ruby
class CreatePuntuacionesEscalas < ActiveRecord::Migration def self.up create_table :puntuaciones_escalas do |t| t.decimal :desde,:precision=>15,:scale=>2,:default=>0 t.decimal :hasta,:precision=>15,:scale=>2,:default=>0 t.timestamps end end def self.down drop_table :puntuaciones_es...
Ruby
class CreateTareas < ActiveRecord::Migration def self.up create_table :tareas do |t| t.string :nombre t.text :descripcion t.integer :peso t.references :cargo t.timestamps end end def self.down drop_table :tareas end end
Ruby
class AddDescripcionToDocumento < ActiveRecord::Migration def self.up add_column :documentos, :descripcion, :text end def self.down remove_column :documentos, :descripcion end end
Ruby
class CreatePlanesAcciones < ActiveRecord::Migration def self.up create_table :planes_acciones do |t| t.datetime :fecha_ejecucion t.datetime :fecha_cierre t.string :nombre t.boolean :efectivo, :default => false t.text :comentario t.integer :responsable_id t.timest...
Ruby
class AddResponsableIdToMarcacion < ActiveRecord::Migration def self.up add_column :marcaciones, :responsable_id, :integer end def self.down remove_column :marcaciones, :responsable_id end end
Ruby
class CreateImportaciones < ActiveRecord::Migration def self.up create_table :importaciones do |t| t.string :nombre t.timestamps end add_column :movimientos, :importacion_id, :integer end def self.down remove_column :movimientos, :importacion_id drop_table :importaciones end en...
Ruby
class RenameColumnOnDescripciones < ActiveRecord::Migration def self.up rename_column :descripciones, :competencia_id, :competencia_cargo_id end def self.down rename_column :descripciones, :competencia_cargo_id, :competencia_id end end
Ruby
class CreateSuperiores < ActiveRecord::Migration def self.up create_table :superiores do |t| t.integer :superior_id t.integer :cargo_id t.timestamps end end def self.down drop_table :superiores end end
Ruby
class CreateUsuarios < ActiveRecord::Migration def self.up create_table :usuarios do |t| t.string :username t.string :email t.string :crypted_password t.string :password_salt t.string :persistence_token t.timestamps end add_index :usuarios, :username, :unique => true ...
Ruby
class CreateHistoricosInternos < ActiveRecord::Migration def self.up create_table :historicos_internos do |t| t.integer :usuario_id t.integer :cargo_id t.integer :nivel_id t.integer :area_id t.integer :sucursal_id t.decimal :salario t.decimal :beneficio t.decimal :v...
Ruby
class ChangeColumnNameOnRespuestas < ActiveRecord::Migration def self.up rename_column :respuestas, :tipo_evaluador, :tipo_evaluado end def self.down rename_column :respuestas, :tipo_evaluado, :tipo_evaluador end end
Ruby
class AddDeletedAtToTiposMovimientos < ActiveRecord::Migration def self.up add_column :tipos_movimientos, :deleted_at, :datetime end def self.down remove_column :tipos_movimientos, :deleted_at end end
Ruby
class AddAfectaAguinaldoToTipoMovimiento < ActiveRecord::Migration def self.up add_column :tipos_movimientos, :afecta_aguinaldo, :boolean end def self.down remove_column :tipos_movimientos, :afecta_aguinaldo end end
Ruby
class CreateResultadosCompetencias < ActiveRecord::Migration def self.up create_table :resultados_competencias do |t| t.references :usuario t.references :evaluacion t.string :competencia_nombre t.integer :competencia_id t.decimal :jefes, :precision => 10, :scale => 2 t.decimal ...
Ruby
class ChangeTypeOfValorOnOpciones < ActiveRecord::Migration def self.up change_column :opciones, :valor, :decimal, :precision => 12, :scale => 2 end def self.down change_column :opciones, :valor, :integer end end
Ruby
class AddAdjuntoToSolicitud < ActiveRecord::Migration def self.up add_column :solicitudes, :adjunto_file_name, :string add_column :solicitudes, :adjunto_content_type, :string add_column :solicitudes, :adjunto_file_size, :integer add_column :solicitudes, :adjunto_updated_at, :datetime ...
Ruby
class CreateSessions < ActiveRecord::Migration def self.up create_table :sessiones do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessiones, :session_id add_index :sessiones, :updated_at end def self.down drop_table :sessiones end end...
Ruby
class AddColumnEsAutoevaluacionToPares < ActiveRecord::Migration def self.up add_column :pares, :es_autoevaluacion, :boolean, :default => false end def self.down remove_column :pares, :es_autoevaluacion end end
Ruby
class AddModuloidToModulos < ActiveRecord::Migration def self.up add_column :modulos, :modulo_id, :integer rename_column :acciones, :modulo_id, :controller_id end def self.down remove_column :modulos, :modulo_id rename_column :acciones, :controller_id, :modulo_id end end
Ruby
class AddMotivoSalidaIdToHistoricosInternos < ActiveRecord::Migration def self.up add_column :historicos_internos, :motivo_salida_id, :integer end def self.down remove_column :historicos_internos, :motivo_salida_id end end
Ruby
class CreateCuentas < ActiveRecord::Migration def self.up create_table :cuentas do |t| t.references :usuario t.references :banco t.string :numero t.string :nombre t.string :tipo t.timestamps end end def self.down drop_table :cuentas end end
Ruby
class CreateTiposExamenes < ActiveRecord::Migration def self.up create_table :tipos_examenes do |t| t.string :nombre t.timestamps end end def self.down drop_table :tipos_examenes end end
Ruby
class CreateEmpresas < ActiveRecord::Migration def self.up create_table :empresas do |t| t.string :nombre t.string :ruc t.timestamps end end def self.down drop_table :empresas end end
Ruby
class CreateVacacionesAntiguedades < ActiveRecord::Migration def self.up create_table :vacaciones_antiguedades do |t| t.integer :desde t.integer :hasta t.integer :dias t.timestamps end end def self.down drop_table :vacaciones_antiguedades end end
Ruby
class AddProfesionToUsuarios < ActiveRecord::Migration def self.up add_column :usuarios, :profesion, :string end def self.down remove_column :usuarios, :profesion end end
Ruby
class CreateEvaluados < ActiveRecord::Migration def self.up create_table :evaluados do |t| t.integer :usuario_id t.integer :evaluado_id t.string :tipo t.integer :evaluacion_id t.string :estado t.timestamps end end def self.down drop_table :evaluados end end
Ruby
class AddDatosPersonalesToUsuario < ActiveRecord::Migration def self.up add_column :usuarios, :registro_conducir, :string add_column :usuarios, :departamento, :string add_column :usuarios, :pais, :string end def self.down remove_column :usuarios, :pais remove_column :usuarios, :departamento ...
Ruby
class AddOrdenToModulo < ActiveRecord::Migration def self.up add_column :modulos, :orden, :integer end def self.down remove_column :modulos, :orden end end
Ruby
class CreateMarcaciones < ActiveRecord::Migration def self.up create_table :marcaciones do |t| t.date :fecha t.time :hora t.integer :usuario_id t.integer :importacion_id t.timestamps end end def self.down drop_table :marcaciones end end
Ruby
class AddProcesoToTareas < ActiveRecord::Migration def self.up add_column :tareas, :proceso_id, :integer remove_column :tareas, :nombre end def self.down remove_column :tareas, :proceso_id add_column :tareas, :nombre, :string end end
Ruby
class CreatePares < ActiveRecord::Migration def self.up create_table :pares do |t| t.integer :par_id t.integer :cargo_id t.timestamps end end def self.down drop_table :pares end end
Ruby
class CreateColumnas < ActiveRecord::Migration def self.up create_table :columnas do |t| t.string :origen, :nombre t.string :destino t.string :proxy t.references :modelo t.integer :tipo t.timestamps end end def self.down drop_table :columnas end end
Ruby
class CreateIncidentes < ActiveRecord::Migration def self.up create_table :incidentes do |t| t.date :fecha t.references :funcionario t.references :identificador t.text :descripcion t.references :hecho t.boolean :apercibimiento t.integer :suspecion_dias t.string :art...
Ruby
class AddClaseToPlanAccion < ActiveRecord::Migration def self.up add_column :planes_acciones, :clase, :string end def self.down remove_column :planes_acciones, :clase end end
Ruby
class AddCodigoToParametro < ActiveRecord::Migration def self.up add_column :parametros, :codigo, :string,:limit=>20 end def self.down remove_column :parametros, :codigo end end
Ruby
class AddObservacionToRecibos < ActiveRecord::Migration def self.up add_column :recibos, :observacion, :text end def self.down remove_column :recibos, :observacion end end
Ruby
class ChangeTypeEfectivoOnPlanAcciones < ActiveRecord::Migration def self.up change_column :planes_acciones, :efectivo, :string end def self.down change_column :planes_acciones, :efectivo, :boolean, :default => false end end
Ruby
class CreateParametros < ActiveRecord::Migration def self.up create_table :parametros do |t| t.string :nombre t.text :descripcion t.string :valor t.timestamps end end def self.down drop_table :parametros end end
Ruby
class CreateFeriados < ActiveRecord::Migration def self.up create_table :feriados do |t| t.string :nombre t.date :fecha t.integer :sucursal_id t.timestamps end end def self.down drop_table :feriados end end
Ruby
class CreateHoras < ActiveRecord::Migration def self.up create_table :horas do |t| t.date :fecha t.integer :motivo t.decimal :cantidad, :precision => 10, :scale => 2 t.boolean :tipo t.text :observacion t.integer :proceso_id,:default=>0,:null=>false t.references :usuario ...
Ruby
class AddComentarioToHistoricosInternos < ActiveRecord::Migration def self.up add_column :historicos_internos, :comentario, :text end def self.down remove_column :historicos_internos, :comentario end end
Ruby
class AddValorToHora < ActiveRecord::Migration def self.up add_column :horas, :valor, :decimal, :precision => 12, :scale => 2 end def self.down remove_column :horas, :valor end end
Ruby
class ChangeTypeValorOnRepuestas < ActiveRecord::Migration def self.up change_column :respuestas, :valor, :decimal, :precision => 12, :scale => 2 end def self.down change_column :respuestas, :valor, :decimal, :precision => 12, :scale => 2 end end
Ruby
class AddSucurcalIdToReciboAndDeletedAtToSucursal < ActiveRecord::Migration def self.up add_column :recibos, :num_cuenta, :string add_column :recibos, :sucursal_id, :integer add_column :sucursales, :deleted_at, :datetime end def self.down remove_column :sucursales, :deleted_at remove_column :...
Ruby
class AddAguinaldoToRecibo < ActiveRecord::Migration def self.up add_column :recibos, :aguinaldo, :boolean,:default => 0 Recibo.update_all ["aguinaldo = ?", false] end def self.down remove_column :recibos, :aguinaldo end end
Ruby
class AddModeloIdToImportacion < ActiveRecord::Migration def self.up add_column :importaciones, :modelo_id, :integer end def self.down remove_column :importaciones, :modelo_id end end
Ruby
class CreateCategorizaciones < ActiveRecord::Migration def self.up create_table :categorizaciones do |t| t.integer :categoria_id t.integer :nivel_id t.decimal :valor t.timestamps end add_index :categorizaciones, :nivel_id add_index :categorizaciones, :categoria_id end def se...
Ruby
class AddIpToMarcacion < ActiveRecord::Migration def self.up add_column :marcaciones, :ip, :string end def self.down remove_column :marcaciones, :ip end end
Ruby
class AddColumnConclucionesToEvaluados < ActiveRecord::Migration def self.up add_column :evaluados, :conclucion, :text end def self.down remove_column :evaluados, :conclucion end end
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV['RSPEC'] = 'true' # allows autotest to discover rspec ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) || $stderr.puts("Unable to find auto...
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/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
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/dbconsole'
Ruby
#!/usr/bin/env ruby if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} require 'rubygems' unless ENV['NO_RUBYGEMS'] else gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV["RAILS_ENV"] ||= 'test' require File.expand_path(File.dirname(__FILE__) + "/../config/enviro...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} require 'rubygems' unless ENV['NO_RUBYGEMS'] else gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV["RAILS_ENV"] ||= 'test' require File.expand_path(File.dirname(__FILE__) + "/../config/enviro...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV['RSPEC'] = 'true' # allows autotest to discover rspec ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) || $stderr.puts("Unable to find auto...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
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/profiler'
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/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby $:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) require 'serenity' class Showcase include Serenity::Generator def generate_showcase @title = 'Serenity inventory' @crew = Usuario.all @reconocimiento= Reconocimiento.all render_odt 'showcase.odt' end end showcase...
Ruby
#!/usr/bin/env ruby $:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) require 'serenity' class Showcase include Serenity::Generator def generate_showcase @title = 'Serenity inventory' @crew = Usuario.all @reconocimiento= Reconocimiento.all render_odt 'showcase.odt' end end showcase...
Ruby
# To change this template, choose Tools | Templates # and open the template in the editor. module SueldosHelper def empresa_grouped_options grouped_options = {} Empresa.all.each do |empresa| grouped_options[empresa.nombre] = empresa.sucursales.map(&sucursal_option_for_select) grouped_options[emp...
Ruby
module CompetenciasHelper def competencia_tipo "'&tipo='+$('#tipo').text()" end def path_for_descripcion(descripcion) if descripcion.new_record? create_descripcion_competencias_path(:competencia_cargo_id => @competencia_cargo.id) else update_descripcion_competencias_path( :compet...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper #Devuelve un tag para el icono de un boton #[nombreimagen] Nombre de la imagen png a utilizar def icono(nombreimagen) nombreimagen ? image_tag(nombreimagen.downcase() +".png", :class => "icono") : '...
Ruby
module FormHelper def select_layout if params["_window"] @window = true @input = params[:input] @campo_id = params[:campo_id] @campo_nombre = params[:campo_nombre] nil else "application" end end end class DotechBuilder < ActionView::Helpers::FormBuilder def date_f...
Ruby
module ImportacionesHelper def columnas(modelo) if modelo.first.is_a?(Hash) columns=modelo.first.keys.delete_if{|x| x.to_s.include?("_at") or x.to_s.include?("id")} else columns=modelo.first.attribute_names.delete_if{|x| x.include?("_at") or x.include?("id")} end columns end def er...
Ruby
module EvaluacionesHelper def params_for_pregunta(pregunta = nil) if pregunta.id "'&pregunta_id=' + #{pregunta.id.to_s} + '&dom_id=' + $(this).parent()[0].id" else "'&dom_id=' + $(this).parent()[0].id" end end def opcion_prefix(pregunta_id, opcion) new_or_existing = opcion.new_record...
Ruby
module AjaxHelper def block_screen(opts={:div_id=>'block',:loading_img=>'loading.gif',:msg=>'Procesando...'}) html=<<HTML <script type="text/javascript"> function blockScreen(){ $.blockUI({ message: $('.#{opts[:div_id]}'),css: {border: 'none',padding: '15px', backgroundColor: '#000','-we...
Ruby
module IncidentesHelper def link_to_premio(i) if i.factor_reconocimiento_id and i.hecho_id and (i.nivel_premiacion or i.premiacion) link_to premio_texto(i.retiro_premio?), i.retiro_premio? ? premio_usuario_incidente_path(i.funcionario,i.id) : premiar_usuario_incidente_path(i.funcionario,i.id) els...
Ruby
module UsuariosHelper #TODO: Mejoras pendientes, evitar la dependencia de la variable @usuario, ya #que en cada accion en el controller, se debe proveer dicha variable def editar? (accion_de_ediccion? and @usuario) end def get_prefix prefix=action_name if action_name=='micuenta' prefix='show...
Ruby