resource = Resource.new attributes
resource.valid? # => true | false
resource.save # => true | false Will raise adapter errors in case of Inconsistency
resource.errors # => ErrorSet (cached) will not reflect adapter errors
resource.attribute=invalid_value
resource.errors # Same error Set as above, will not reflect attribute change
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
# this is full of bad metaprogramming | |
class EmbeddedItems < DataMapper::Mongo::Property::Array | |
def load(value) | |
if value.nil? | |
nil | |
elsif value.is_a? ::Array | |
value.map { |item| embedded_item_class.load item }.extend collection | |
else | |
raise ArgumentError.new "+value+ of a property of #{self.class} type must be ::Array was: #{value.class}" | |
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
property :id, Serial | |
property :name, String, required: true | |
property :size, Integer | |
property :type, String | |
property :content, Binary, lazy: true, length: 1..209715200 | |
property :uri, URI | |
property :created_at, DateTime | |
property :updated_at, DateTime | |
belongs_to :folder, model: Filemanager::Folder |
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
[2011-10-10 17:45:24] make -j2 | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c array.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c bignum.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c class.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c compar.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c dir.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c dln.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c enum.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c enumerator.c | |
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c error.c |
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
/home/mbj/.rvm/gems/ruby-1.9.3-rc1/gems/nokogiri-1.5.0/lib/nokogiri/html/document_fragment.rb:23: [BUG] Segmentation fault | |
ruby 1.9.3dev (2011-09-23 revision 33323) [x86_64-linux] | |
-- Control frame information ----------------------------------------------- | |
c:0139 p:0091 s:0720 b:0719 l:000718 d:000718 METHOD /home/mbj/.rvm/gems/ruby-1.9.3-rc1/gems/nokogiri-1.5.0/lib/nokogiri/html/document_fragment.rb:23 | |
c:0138 p:---- s:0709 b:0709 l:000708 d:000708 FINISH | |
c:0137 p:---- s:0707 b:0707 l:000706 d:000706 CFUNC :new | |
c:0136 p:0063 s:0701 b:0701 l:000700 d:000700 METHOD /home/mbj/.rvm/gems/ruby-1.9.3-rc1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:498 | |
c:0135 p:0094 s:0696 b:0696 l:000695 d:000695 METHOD /home/mbj/.rvm/gems/ruby-1.9.3-rc1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:894 | |
c:0134 p:0013 s:0692 b:0692 l:000691 d:000691 METHOD /home/mbj/.rvm/gems/ruby-1.9.3-rc1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:396 |
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
/home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/bson-1.5.1/lib/bson/bson_c.rb:28:in `new': Interrupt | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/bson-1.5.1/lib/bson/bson_c.rb:28:in `deserialize' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/networking.rb:211:in `read_documents' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/networking.rb:158:in `receive' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/networking.rb:123:in `receive_message' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/cursor.rb:508:in `send_get_more' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/cursor.rb:460:in `refresh' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/cursor.rb:128:in `next' | |
from /home/mbj/devel/foobar/vendor/ruby/1.9.1/gems/mongo-1.5.1/lib/mongo/cursor.rb:290:in `each' | |
from /home/mbj/devel/foob |
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
DM_VERSION = '1.3.0.beta' | |
%w(core migrations types aggregates timestamps validations sqlite-adapter do-adapter).each do |name| | |
if name == 'validations' && ENV['WITHOUT_BREAKING_COMMIT'] | |
gem 'dm-validations', DM_VERSION, :git => 'git://github.com/mbj/dm-validations', :branch => 'test/without-breaking-commit' | |
else | |
gem "dm-#{name}", DM_VERSION, :git => "git://github.com/datamapper/dm-#{name}.git" | |
end | |
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
service auth { | |
unix_listener auth-userdb { | |
mode = 0660 | |
group = vmail | |
} | |
unix_listener /var/spool/postfix/private/auth { | |
mode = 0666 | |
} | |
} |
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
Steps before running a batch job on any production mongo cluster: | |
#1 If you are not the operator, ask him before. | |
#2 Test the batch on a copy of the dataset before. If the dataset is big, make a representational slice. | |
#3 Ensure you have a recent backup (or a write behind slave). Bad batches can destroy the company. | |
#4 Run the batch on "low traffic" times. | |
#5 Ensure you limit the batch rate using consistent writes to at least one slave. | |
#6 Notify support, staff, and all possible related personnel before and after the batch. | |
#7 If you cause any problem, add a solution rule to this document. |
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
module DataMapper | |
class Property | |
class EmbeddedDocument < Property | |
coercion_method nil | |
dump_as Hash | |
accept_options :document_class | |
protected |
OlderNewer