<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>A little place of calm - Latest Comments in A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimeeblog.disqus.com/</link><description>Aimee's personal blog</description><language>en</language><lastBuildDate>Sun, 11 Oct 2009 06:22:51 -0000</lastBuildDate><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-19843726</link><description>I've been following ever stop of this, it's great</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bondage</dc:creator><pubDate>Sun, 11 Oct 2009 06:22:51 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-14822993</link><description>Could you please explain the difference between Active record &amp; RelaxDB in detail with some more examples.&lt;br&gt;&lt;br&gt;Thanks&lt;br&gt;Regards</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mia</dc:creator><pubDate>Fri, 14 Aug 2009 01:40:18 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-13583612</link><description>Thank you for this step by step tutorial..&lt;br&gt;It is really a big help especially for me that I'm a newbie in this...&lt;br&gt;Great post..</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Guest</dc:creator><pubDate>Wed, 29 Jul 2009 21:49:27 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-8774637</link><description>thanks</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">RoGer</dc:creator><pubDate>Tue, 28 Apr 2009 10:08:29 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-7373458</link><description>Hi,&lt;br&gt;&lt;br&gt;the bug was in view path and map/emit function for CouchDB 0.9.0a &lt;br&gt;&lt;br&gt;fix&lt;br&gt;&lt;a href="http://github.com/madrugao/relaxdb/tree/abe62f7a41ef85faf9829d600ac553682390a5f7" rel="nofollow"&gt;http://github.com/madrugao/relaxdb/tree/abe62f7...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">madrugao</dc:creator><pubDate>Fri, 20 Mar 2009 10:58:39 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-7262616</link><description>Hi Aimee,&lt;br&gt;&lt;br&gt;you had this problem?&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; Cd.all&lt;br&gt;RuntimeError: 500:Internal Server Error&lt;br&gt;METHOD:GET&lt;br&gt;URI:/cd_collection/_view/Cd/all?reduce=false&lt;br&gt;{"error":"query_parse_error","reason":"Bad URL query key:reduce"}&lt;br&gt;&lt;br&gt;madrugao</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">madrugao</dc:creator><pubDate>Mon, 16 Mar 2009 15:14:49 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-7235364</link><description>Hello. Thanks for sharing your thoughts. It was helpful article for me. Thanks.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Laurynas</dc:creator><pubDate>Sun, 15 Mar 2009 09:16:59 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-5865498</link><description>Hi Aimee. I haven't seen a example of new or edit template. I'm very curious about how to create forms with relaxdb, since the usual way is not working</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruno</dc:creator><pubDate>Thu, 23 Oct 2008 09:43:44 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-5865499</link><description>@Paul, wow, it's great to have you following along and responding to the particular issues that i've encountered. Thank you for the helpful hints about validations. That makes perfect sense to me. The ability to ensure properties are of a particular type will be very useful, i am sure.&lt;br&gt;&lt;br&gt;@Randy, great! I'm so pleased that you found my notes helpful and got things working okay. To get me started i want something similar to ActiveRecord, and RelaxDB was certainly a good help. Next i'm going to move on to the Ruby libraries couchrest and couchobject, which i think will give me a little more flexibility.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sermoa</dc:creator><pubDate>Fri, 12 Sep 2008 13:57:20 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-5865501</link><description>I played around with CouchDb (via CouchDBX on the Mac) and RelaxDb.  I got it working very quicky, thanks to Aimee's excellent walk-through and the total ease of running CouchDBX on the Mac.&lt;br&gt;&lt;br&gt;I didn't try validations, so I can't comment on that aspect of it.  &lt;br&gt;&lt;br&gt;One thing that I noticed was that properties are not inherited via subclasses.  That would be a nice feature in my opinion.&lt;br&gt;&lt;br&gt;I also see both sides of the argument, concerning a schema-less model vs the need to define properties in the model (ala DataMapper).  &lt;br&gt;&lt;br&gt;I think CouchDb is fantastically powerful and full of potential.  However, I can't wrap my mind past the views and the reduce.  However, seeing how RelaxDb uses those views to make some easy to use relationships, properties, and searching for those properties, makes a lot of sense.&lt;br&gt;&lt;br&gt;There's an interesting balance to find in RelaxDb.  Easy to use for the Rails ActiveRecord guys (like me) versus the flexibility available to CouchDb (via map/reduce and views).  Personally, I'd love to throw a whole bunch of hash like structs into couchdb, and then search, modify, and aggregate those documents, without having to wrap my mind around map/reduce.  But, that's just me.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Randy</dc:creator><pubDate>Fri, 12 Sep 2008 12:55:07 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-5865503</link><description>Thanks for the example. As you observed, validation isn't great. &lt;br&gt;&lt;br&gt;The reason validation wasn't working for title or artist is because nil != "" is true. You probably want something like lambda {|t| not t.blank? } for your strings.&lt;br&gt;&lt;br&gt;To ensure that a string gets converted to a number, things get ugly :) &lt;br&gt;before_save lambda { |o| o.year_of_release = o.year_of_release.to_i }&lt;br&gt;property :year_of_release, :validator =&amp;gt; lambda {|p| p &amp;gt; 1908}, :validation_msg =&amp;gt; "must be &amp;gt; 1908"&lt;br&gt;&lt;br&gt;I'll probably add something like&lt;br&gt; property, :foo, :is =&amp;gt;Fixnum&lt;br&gt;over the coming week, but I want to think about how that ties in with callbacks and validation first.&lt;br&gt;&lt;br&gt;If you really want to dynamically define properties, one approach would be to subclass RelaxDB::Document and define method_missing so it invoked property on the class.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">PaulCarey</dc:creator><pubDate>Fri, 12 Sep 2008 08:07:25 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-5865502</link><description>Hi Paul, thanks for your thoughts. I do think that dynamic properties are a major strength of CouchDB. I guess you have played with the web interface that comes with CouchDB? You can just add as many fields as you like, with any name you like. Each document can have an entirely different set of fields, if it wishes.&lt;br&gt;&lt;br&gt;I think the couchrest plugin allows dynamic fields without any need for module_eval.&lt;br&gt;&lt;br&gt;The validation fails as follows. Here is the model:&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;pre&gt;class Cd &amp;lt; RelaxDB::Document&lt;br&gt;  property :title, :validator =&amp;gt; lambda {|t| t != ""}, :validation_msg =&amp;gt; "cannot be blank" &lt;br&gt;  property :artist, :validator =&amp;gt; lambda {|t| t != ""}, :validation_msg =&amp;gt; "cannot be blank" &lt;br&gt;  property :publisher&lt;br&gt;  property :year_of_release, :validator =&amp;gt; lambda {|p| p.to_i &amp;gt; 0}, :validation_msg =&amp;gt; "must be a number" &lt;br&gt;end&lt;/pre&gt;&lt;br&gt;&lt;br&gt;If i try to save a new empty CD it gives me all three error messages. If i then fill in just the year_of_release, leaving title and artist both blank, it saves.&lt;br&gt;&lt;br&gt;If i remove the year_of_release validation (so that it just validates title and artist) then it works as expected and doesn't let me save until i enter both a title and an artist.&lt;br&gt;&lt;br&gt;To be honest, maybe i got the validation wrong. I wrote it last night when i was tired and in a hurry to finish the blog post. Now that i look at it, i realise that it is not actually converting the value at all. So if i enter "123bubbles" it will probably pass the validation but store "123bubbles" in the database! Oops! How do you recommend validating a number?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sermoa</dc:creator><pubDate>Fri, 12 Sep 2008 03:17:05 -0000</pubDate></item><item><title>Re: A little place of calm  &amp;raquo; Blog Archive   &amp;raquo; CouchDB on Rails (part 6 of ?)</title><link>http://aimee.mychores.co.uk/2008/09/12/post/328#comment-5865504</link><description>Hi Aimee&lt;br&gt;&lt;br&gt;I'll echo what Jan said - this is a great series.&lt;br&gt;&lt;br&gt;I'm glad you got RelaxDB running on rails. I'm sorry I can't offer any advice as to where you should configure the connection, but you know more than I do at this point!&lt;br&gt;&lt;br&gt;(I've pasted code related to this reply on &lt;a href="http://friendpaste.com/565hyrmA" rel="nofollow"&gt;http://friendpaste.com/565hyrmA&lt;/a&gt;)&lt;br&gt;&lt;br&gt;&amp;gt; It’s a shame i have to [add properties to a model]&lt;br&gt;&lt;br&gt;That's interesting, I hadn't considered the need for adding properties dynamically. You could do it with module_eval or instance.class.instance_eval but I'm guessing that's not quite what you were looking for.&lt;br&gt;&lt;br&gt;&amp;gt; To order them by artist then title, we can do this:&lt;br&gt;&lt;br&gt;You've probably also seen that sorted_by yields a query object that maps directly to CouchDB query params. &lt;br&gt;&lt;br&gt;&amp;gt; Sometimes it lets it through even when the validation blatantly fails.&lt;br&gt;&lt;br&gt;Hmm, that's not so good. If you have an example of where it fails, please send it on.&lt;br&gt;&lt;br&gt;Looking forward to the next installment.&lt;br&gt;Paul</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">PaulCarey</dc:creator><pubDate>Thu, 11 Sep 2008 22:27:55 -0000</pubDate></item></channel></rss>