Hello to all!
Im using couch db (dm 0.9.6) and with merb 1.0 I've a lot of problems.
I dont know why I get problems with attachments. I tryed couchdb 0.8.1
and last svn trunk... problem are the same:
Especially with *.png attachments I get:
merb : worker (port 4000) ~ Params: {"format"=>nil,
"submit"=>"Create", "action"=>"create", "post"=>
{"name"=>"sdfasdfasdf", "description"=>"asdfasdfasd",
"category_id"=>"24d2c21f528a3e4740407e3546895d2b", "file"=>
{"content_type"=>"image/png", "size"=>5460, "tempfile"=>#<File:/var/
folders/qK/qKuYnv50GH08UjxgNlLgRE+++TI/-Tmp-/Merb.353.0>,
"filename"=>"Gravatar.png"}}, "controller"=>"posts"}
merb : worker (port 4000) ~ end of file reached - (EOFError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/protocol.rb:133:in `sysread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/protocol.rb:133:in `rbuf_fill'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/timeout.rb:56:in `timeout'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/timeout.rb:76:in `timeout'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/protocol.rb:132:in `rbuf_fill'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/protocol.rb:116:in `readuntil'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/protocol.rb:126:in `readline'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:2029:in `read_status_line'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:2018:in `read_new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:1059:in `request'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:854:in `post'
/Library/Ruby/Gems/1.8/gems/dm-couchdb-adapter-0.9.6/lib/
couchdb_adapter.rb:325:in `http_post'
/Library/Ruby/Gems/1.8/gems/dm-couchdb-adapter-0.9.6/lib/
couchdb_adapter.rb:339:in `request'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:547:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:440:in `start'
/Library/Ruby/Gems/1.8/gems/dm-couchdb-adapter-0.9.6/lib/
couchdb_adapter.rb:338:in `request'
/Library/Ruby/Gems/1.8/gems/dm-couchdb-adapter-0.9.6/lib/
couchdb_adapter.rb:325:in `http_post'
Couch log:
L+97\\nuY01YR2P7Sp+dP\\/1wBX\\/o4lLBtL\\/c9i9UNlc5B9p2Ff8Iw7PvR912Lz\\/
D5n7\\nsPuw+7D7sPuw+7D7sPuw+7D7sPuw+7D7sPuw+7D7sPuwr\\/T1PwIMAAAF7iyN\
\ny3wiAAAAAElFTkSuQmCC\"}},\"couchdb_type\":\"post\",\"category_id\":
\"24d2c21f528a3e4740407e3546895d2b\",\"description\":\"asdfasdfasd\",
\"created_at\":\"2008-11-18T00:19:45+01:00\"}">>},
{mochiweb_request_recv,true}]},
{trap_exit,false},
{status,running},
{heap_size,28657},
{stack_size,23},
{reductions,28571}],
[]]}}
[error] [<0.56.0>] {error_report,<0.22.0>,
{<0.56.0>,std_error,
{mochiweb_socket_server,235,
{child_error,function_clause}}}}
=ERROR REPORT==== 18-Nov-2008::00:19:45 ===
{mochiweb_socket_server,235,{child_error,function_clause}}
My model:
class Post
include DataMapper::Resource
property :attachments, JsonObject, :field => :_attachments
property :id, String, :key => true, :field => :_id, :nullable =>
true
property :rev, String, :field => :_rev
property :name, String, :nullable => false
property :description, Text, :nullable => false
property :category_id, String, :nullable => false
property :created_at, DateTime
property :updated_at, DateTime
belongs_to :category
attr_reader :file
def file=(file)
if file[:tempfile]
add_attachment(file[:tempfile], :name => file
[:filename], :content_type => file[:content_type])
end
end
view :by_date, { "map" => "function(doc) { if (doc.couchdb_type ==
'post') emit(doc.created_at, doc) }"}
end
Last question, is advisable to use couchdb in production? What are the
big disadvantages?
Ive a logic trouble. What happen If I rename some cols/fields in my
docs?
property :naming = become => property :name
Ive some docs with old filed name, and last edited or new documents/
records with the new field name.
How people resolve this big problems?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---