code
stringlengths
1
1.73M
language
stringclasses
1 value
class CreateLineasDespachos < ActiveRecord::Migration def self.up create_table :lineas_despachos do |t| t.integer :existencia_id t.integer :depacho_id t.integer :cantidad t.boolean :esta_activo t.timestamps end end def self.down drop_table :lineas_despachos end end
Ruby
class CreateUmedidas < ActiveRecord::Migration def self.up create_table :umedidas do |t| t.string :descripcion t.timestamps end end def self.down drop_table :umedidas end end
Ruby
class AsginadoRevision < ActiveRecord::Migration def self.up remove_column "asignados", "existencia_id" end def self.down end end
Ruby
class CreateDesasignados < ActiveRecord::Migration def self.up create_table :desasignados do |t| t.date :fecha t.integer :asignado_id t.integer :motivo_id t.text :descripcion t.timestamps end end def self.down drop_table :desasignados 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
require 'prawn' Prawn::Document.generate('hello.pdf') do |pdf| #pdf.font "Helvetica" #pdf.font.size = 13 pdf.text "Asignación: #{@asignado.id}", :size => 16, :style => :bold, :spacing => 4 pdf.text "Fecha: #{@asignado.fecha}", :spacing => 16 pdf.text "Persona: #{@asignado.persona.nombre_apellido}", :spacing =...
Ruby
module DesasignadosHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper # Método para ordernar las columnas de una tabla def sortable(column, title = nil) title ||= column.titleize css_class = column == sort_column ? "current #{sort_direction}" : nil dir = sort_dir...
Ruby
module AsignadosHelper end
Ruby
module MotivosHelper end
Ruby
module CgeneralsHelper end
Ruby
module LineasAsignadosHelper end
Ruby
module MarcasHelper end
Ruby
module PersonasHelper end
Ruby
module FacturasHelper end
Ruby
module ProveedorsHelper end
Ruby
module ActivosHelper end
Ruby
module LineasDespachosHelper end
Ruby
module FichasHelper end
Ruby
module CareasHelper end
Ruby
module LineasDesasignadosHelper end
Ruby
module ExistenciasHelper end
Ruby
module DespachosHelper end
Ruby
module UmedidasHelper end
Ruby
module UbicacionesHelper end
Ruby
class Persona < ActiveRecord::Base belongs_to :carea belongs_to :ubicacione has_many :asignados has_many :despachos def nombre_apellido nombre + " " + apellido end end
Ruby
class Ficha < ActiveRecord::Base belongs_to :umedida belongs_to :activo end
Ruby
class Motivo < ActiveRecord::Base has_many :desasignados end
Ruby
class Cgeneral < ActiveRecord::Base has_many :careas end
Ruby
class Asignado < ActiveRecord::Base has_many :desasignados has_many :lineas_asignados belongs_to :persona end
Ruby
class Ubicacione < ActiveRecord::Base has_many :personas end
Ruby
class Marca < ActiveRecord::Base has_many :activos validates_presence_of(:descripcion, :message => "Debe especificar la descripción de la marca") end
Ruby
class LineasAsignado < ActiveRecord::Base belongs_to :asignado belongs_to :existencia end
Ruby
class Carea < ActiveRecord::Base has_many :personas belongs_to :cgeneral end
Ruby
class Despacho < ActiveRecord::Base belongs_to :persona end
Ruby
class Existencia < ActiveRecord::Base belongs_to :factura belongs_to :activo has_many :lienas_asignados has_many :lineas_despachos end
Ruby
class Desasignado < ActiveRecord::Base belongs_to :motivo belongs_to :asignado end
Ruby
class Umedida < ActiveRecord::Base has_many :fichas end
Ruby
class LineasDespacho < ActiveRecord::Base belongs_to :existencia end
Ruby
class Activo < ActiveRecord::Base has_many :existencias has_many :fichas belongs_to :marca end
Ruby
class Factura < ActiveRecord::Base belongs_to :proveedor has_many :existencias end
Ruby
class Proveedor < ActiveRecord::Base has_many :facturas validates_presence_of(:nombre, :message => "Debe especificar el nombre del proveedor") validates_presence_of(:rif, :message => "Debe especificar el RIF del proveedor") validates_format_of(:rif, :with => /^[Jj]-(\d\d\d\d\d\d\d\d)-[0-9]$/, :message => "Fo...
Ruby
class LineasAsignadosController < ApplicationController # GET /lineas_asignados # GET /lineas_asignados.xml def index @lineas_asignados = LineasAsignado.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @lineas_asignados } end end # GET /lineas_asig...
Ruby
class PersonasController < ApplicationController helper_method :sort_column, :sort_direction # GET /personas # GET /personas.xml def index #@personas = Persona.all @personas = Persona.find(:all, :order => sort_column + ' ' + sort_direction) #@personas = Persona.order(params[:sort]) respond_t...
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 layout 'standard' helper :all # include all helpers, all the time protect_from_forgery # See ActionControll...
Ruby
class FichasController < ApplicationController auto_complete_for :ficha, :componente # GET /fichas # GET /fichas.xml def index @fichas = Ficha.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @fichas } end end # GET /fichas/1 # GET /fichas/1...
Ruby
class CareasController < ApplicationController # GET /careas # GET /careas.xml def index @careas = Carea.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @careas } end end # GET /careas/1 # GET /careas/1.xml def show @carea = Carea.find(par...
Ruby
class AsignadosController < ApplicationController # GET /asignados # GET /asignados.xml def index @asignados = Asignado.find(:all, :order => "id ASC") respond_to do |format| format.html # index.html.erb format.xml { render :xml => @asignados } end end # GET /asignados/1 # GET /asi...
Ruby
class MarcasController < ApplicationController # GET /marcas # GET /marcas.xml def index @marcas = Marca.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @marcas } end end # GET /marcas/1 # GET /marcas/1.xml def show @marca = Marca.find(par...
Ruby
class FacturasController < ApplicationController # GET /facturas # GET /facturas.xml def index @facturas = Factura.paginate :page => (/[1-9]+/ === params[:page] ? params[:page] : 1), :per_page => 10 respond_to do |format| format.html # index.html.erb format.xml { render :xml => @facturas } ...
Ruby
class ExistenciasController < ApplicationController auto_complete_for :activo, :descripcion # GET /existencias # GET /existencias.xml def index @existencias = Existencia.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @existencias } end end # G...
Ruby
class UmedidasController < ApplicationController # GET /umedidas # GET /umedidas.xml def index @umedidas = Umedida.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @umedidas } end end # GET /umedidas/1 # GET /umedidas/1.xml def show @umedid...
Ruby
class UbicacionesController < ApplicationController # GET /ubicaciones # GET /ubicaciones.xml def index @ubicaciones = Ubicacione.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @ubicaciones } end end # GET /ubicaciones/1 # GET /ubicaciones/1.xm...
Ruby
class CgeneralsController < ApplicationController # GET /cgenerals # GET /cgenerals.xml def index @cgenerals = Cgeneral.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @cgenerals } end end # GET /cgenerals/1 # GET /cgenerals/1.xml def show ...
Ruby
class LineasDespachosController < ApplicationController # GET /lineas_despachos # GET /lineas_despachos.xml def index @lineas_despachos = LineasDespacho.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @lineas_despachos } end end # GET /lineas_desp...
Ruby
class DespachosController < ApplicationController # GET /despachos # GET /despachos.xml def index @despachos = Despacho.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @despachos } end end # GET /despachos/1 # GET /despachos/1.xml def show ...
Ruby
class MotivosController < ApplicationController # GET /motivos # GET /motivos.xml def index @motivos = Motivo.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @motivos } end end # GET /motivos/1 # GET /motivos/1.xml def show @motivo = Motiv...
Ruby
class ProveedorsController < ApplicationController # GET /proveedors # GET /proveedors.xml def index @proveedors = Proveedor.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @proveedors } end end # GET /proveedors/1 # GET /proveedors/1.xml def ...
Ruby
class ActivosController < ApplicationController auto_complete_for :ficha, :componente # GET /activos # GET /activos.xml def index @activos = Activo.all @marcas = Marca.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @activos } end end...
Ruby
class DesasignadosController < ApplicationController # GET /desasignados # GET /desasignados.xml def index @desasignados = Desasignado.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @desasignados } end end # GET /desasignados/1 # GET /desasigna...
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
# 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 :lineas_despachos map.resources :lineas_desasignados map.resources :desasignados map.resources :motivos # map.resources :lineas_asignados map.resources :despachos map.resources :asignados map.resources :existencias map.resources :fic...
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
ActiveRecord::Base.send :include, CacheColumns::ActiveRecord
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the cache_columns plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the cache_columns pl...
Ruby
# desc "Explaining what the task does" # task :cache_columns do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby
# Install hook code here
Ruby
module CacheColumns module ActiveRecord @@columns = {} def self.included(base) base.instance_eval do alias old_columns columns alias old_reset_column_information reset_column_information def columns if @@columns[table_name].nil? @@columns[table_name] = co...
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