This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10.times {puts "ALQUILER!"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PeopleController < ApplicationController | |
respond_to :html, :xml, :json | |
expose(:person) | |
def create | |
person.save | |
respond_with(person) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hello World in Java | |
class HelloWorld { | |
static public void main( String args[] ) { | |
System.out.println( "Hello World!" ); | |
} | |
} | |
############################################################################################# | |
//Hello World in C# | |
class HelloWorld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event < Ohm::Model | |
KINDS = %w[creation approval disapproval reception delivery] | |
reference :user, lambda { |id| User.find(id)} | |
reference :item, lambda { |id| id.nil? ? nil : Item.find(id)} | |
reference :transaction, lambda { |id| id.nil? ? nil : Transaction.find(id)} | |
attribute :kind | |
attribute :text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event < Ohm::Model | |
reference :user, lambda { |id| User.find(id)} | |
reference :item, lambda { |id| Item.find(id)} | |
reference :transaction, lambda { |id|Transaction.find(id)} | |
attribute :kind | |
attribute :text | |
attribute :created_at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p136 > e = Event[1] | |
=> #<Event:1 user_id="1" item_id="3" transaction_id="2" kind="reception" text=nil created_at="2011-04-20 14:32:19 -0300"> | |
ruby-1.9.2-p136 > e.item | |
NoMethodError: You tried to call Item#find, but Item is not defined on /home/porta/Dropbox/Code/rails3/barter/app/models/event.rb:4:in `block in <class:Event>' | |
from /home/porta/.rvm/gems/ruby-1.9.2-p136@barter/gems/ohm-0.1.3/lib/ohm.rb:215:in `method_missing' | |
from /home/porta/Dropbox/Code/rails3/barter/app/models/event.rb:4:in `block in <class:Event>' | |
from /home/porta/.rvm/gems/ruby-1.9.2-p136@barter/gems/ohm-0.1.3/lib/ohm.rb:1192:in `[]' | |
from /home/porta/.rvm/gems/ruby-1.9.2-p136@barter/gems/ohm-0.1.3/lib/ohm.rb:1192:in `block in reference' | |
from /home/porta/.rvm/gems/ruby-1.9.2-p136@barter/gems/ohm-0.1.3/lib/ohm.rb:1275:in `instance_eval' | |
from /home/porta/.rvm/gems/ruby-1.9.2-p136@barter/gems/ohm-0.1.3/lib/ohm.rb:1275:in `block in define_memoized_method' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$nombre=$_REQUEST["nombre"]; | |
$email=$_REQUEST["email"]; | |
$filename=$_FILES["strresume"]["name"]; | |
$filetype=$_FILES["strresume"]["type"]; | |
$filesize=$_FILES["strresume"]["size"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProductsController < ApplicationController | |
#OJO ACA, esto limita los responses a SOLO json. podes agregar mas | |
respond_to :json | |
def index | |
resultado = Array.new | |
Product.find_each do |p| | |
resultado.push(p_para_json(p)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should reject a new task" do | |
task = Factory(:task) | |
task.reject | |
task.rejected.should be_true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state_machine :status, :initial => :new do | |
event :accept do | |
transition :new => :accepted | |
end | |
event :reject do | |
transition :new => :rejected | |
end |
OlderNewer