This file contains hidden or 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
resources :people, :collection => {:search => :get}, :member => {:calculator => :post} |
This file contains hidden or 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
message = "Resource#id is deprecated. Either use Resource#key to retrieve the key(s) or use " | |
message << "one of " if key.size > 1 | |
message << key_properties.map {|property| "#{self.class.to_s}##{property.name.to_s}" }.join(", ") | |
warn(message) | |
This file contains hidden or 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
diff --git a/spec/lib/resource_shared_spec.rb b/spec/lib/resource_shared_spec.rb | |
index 6c2bad8..76cabe8 100644 | |
--- a/spec/lib/resource_shared_spec.rb | |
+++ b/spec/lib/resource_shared_spec.rb | |
@@ -209,4 +209,129 @@ share_examples_for 'A Resource' do | |
end | |
end | |
+ | |
+ it 'should respond to #eql?' |
This file contains hidden or 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
1) | |
'DataMapper::Associations::OneToMany::Proxy#delete_at with an index within the Collection should be the expected Resource' FAILED | |
expected: #<Article id=1 title="Sample Article" content="Sample" article_id=nil author_id=1>, | |
got: #<Article id=1 title="Sample Article" content="Sample" article_id=nil author_id=nil> (using ==) | |
/Users/dirkjan/Documents/projects/dm-core-spec/spec/lib/collection_shared_spec.rb:476: | |
2) | |
'DataMapper::Associations::OneToMany::Proxy#shift should be the first Resource in the Collection' FAILED | |
expected: #<Article id=1 title="Sample Article" content="Sample" article_id=nil author_id=1>, | |
got: #<Article id=1 title="Sample Article" content="Sample" article_id=nil author_id=nil> (using ==) |
This file contains hidden or 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
diff --git a/lib/dm-core/collection.rb b/lib/dm-core/collection.rb | |
index 0e2938d..c094100 100644 | |
--- a/lib/dm-core/collection.rb | |
+++ b/lib/dm-core/collection.rb | |
@@ -634,11 +634,7 @@ module DataMapper | |
# | |
# @api public | |
def update(attributes = {}, *allowed) | |
- unless attributes.empty? | |
- each { |r| r.update(attributes, *allowed) } |
This file contains hidden or 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
match("/week/:week") do | |
resources :people, :name_prefix => "week", :resource_prefix => "Week" do | |
resources :addresses | |
end | |
end | |
resource(Week.new(2008, 10), Person.first) | |
=============================== |
This file contains hidden or 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 Person | |
property :id | |
property :name | |
has n, :addresses | |
end | |
class Address | |
include DataMapper::Resource | |
This file contains hidden or 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
t = Thread.new do | |
puts "It's: #{Time.now}" | |
sleep(10) | |
puts "It's: #{Time.now}" | |
end | |
sleep(4) | |
t.wakeup | |
t.join |
This file contains hidden or 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
Changing the FK | |
Person | |
has n, :addresses | |
Address | |
belongs_to :person | |
@address = Address.first | |
@person = @address.person |
This file contains hidden or 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
Address.new(:person => person) | |
person.addresses.new() | |
person.addresses << Address.new() |