Skip to content

Instantly share code, notes, and snippets.

*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0.beta, 2.3.5, 2.3.3)
actionpack (3.0.0.beta, 2.3.5, 2.3.3)
activemodel (3.0.0.beta)
activerecord (3.0.0.beta, 2.3.5, 2.3.3)
activeresource (3.0.0.beta, 2.3.5, 2.3.3)
activesupport (3.0.0.beta, 2.3.5, 2.3.3)
arel (0.2.1)
olvap@Lara:~$ rubywarrior
Welcome to Ruby Warrior
/home/olvap/.gem/ruby/1.8/gems/rubywarrior-0.1.1/lib/ruby_warrior/profile.rb:31:in `load': incompatible marshal file format (can't be read) (TypeError)
format version 4.8 required; 254.154 given from /home/olvap/.gem/ruby/1.8/gems/rubywarrior-0.1.1/lib/ruby_warrior/profile.rb:31:in `decode'
from /home/olvap/.gem/ruby/1.8/gems/rubywarrior-0.1.1/lib/ruby_warrior/profile.rb:35:in `load'
from /home/olvap/.gem/ruby/1.8/gems/rubywarrior-0.1.1/lib/ruby_warrior/game.rb:8:in `start'
from /home/olvap/.gem/ruby/1.8/gems/rubywarrior-0.1.1/lib/ruby_warrior/runner.rb:17:in `run'
from /home/olvap/.gem/ruby/1.8/gems/rubywarrior-0.1.1/bin/rubywarrior:5
from /usr/local/bin/rubywarrior:19:in `load'
from /usr/local/bin/rubywarrior:19
# models
# Ptgi
class Ptgi < ActiveRecord::Base
has_many :deudas, :as =>:parametro
end
#Deuda
class Deuda < ActiveRecord::Base
belongs_to :parametro, :polymorphic => true
end
#in the model
class Mymodel < ActiveRecord::Base
named_scope :periodos, lambda{
|*args|{
:conditions => ['periodo >=? and periodo <=?',args.first ||0,args.second || 99999 ]
}
}
end
#view
class ContribuyentesController < ApplicationController
def baja
@contribuyente = Contribuyente.find(params[:id])
@contribuyente.estado_id = 1
@contribuyente.save
redirect_to(@contribuyente)
end
i installed ruby doing this.
sudo apt-get -y install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline5-dev zlib1g-dev
$ cd ~
$ cd usr/src/
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz
$ tar xzvf ruby-1.9.1-p243.tar.gz
$ cd ruby-1.9.1-p243/
.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
//code
var win=0;
var mygrid;
var col;
function columns(url){
$.getJSON("/provincias.json", function(data) {
col = ["id","nombre"];
});
alert(col);
#xml
<?xml version="1.0" encoding="UTF-8"?>
<localidad>
<created-at type="datetime">2010-11-28T01:12:59Z</created-at>
<departamento-id type="integer">1</departamento-id>
<id type="integer">1</id>
<name>16 DE JULIO</name>
<updated-at type="datetime">2010-11-28T01:12:59Z</updated-at>
models
Class User < ActiveRecord::Base
belongs_to :state
end
Class State < ActiveRecord::Base
end