Commit graph

76 commits

Author SHA1 Message Date
Sam Lown
dd3df8fb69 Adding support for defining cast_as on properties as a Class 2010-03-30 20:50:47 +00:00
Sam Lown
64d68ecc1a Using Classes instead of strings for typecasting and removing redundant comparisons 2010-03-30 19:06:24 +00:00
Sam Lown
c906be229f Small fix 2010-03-05 14:40:51 +00:00
Sam Lown
ca23e186f4 Added ActiveRecord like after_initialize callback to ExtendedDocument 2010-03-03 20:01:27 +00:00
Sam Lown
d992f44365 Refactoring typecast so that it is less invasive and uses latest code base 2010-03-03 02:18:32 +00:00
Sam Lown
88f42d8fe0 Merge branch 'master' of git://github.com/sauy7/couchrest 2010-03-03 00:18:32 +00:00
Marcos Tapajós
17dac85a02 Changing CouchRest::ExtendedDocument to allow chaining the inherit class callback 2010-02-26 21:57:42 -03:00
Will Leinweber
d41c7c96da BUGFIX: attribute protection
Fixes bug where documents recreated from the database were
being stripped of their protected attributes when instantiated

Signed-off-by: Marcos Tapajos <tapajos@Tapajos-MacBook.local>
2010-02-26 17:18:10 -06:00
Will Leinweber
15ea10eb9c attempt to merge wildchild/type_cast, still failing specs 2010-02-17 16:35:42 -06:00
deepj
b8bda3bb02 Initialization of ExtendentDocument model shouldn't failed on a nil value in argument
Signed-off-by: Tapajós <tapajos@gmail.com>
2009-11-10 07:52:33 -02:00
Tapajós
1315d65681 Using |attribute_name, attribute_value| instead of |k,v|. 2009-10-31 10:42:36 -02:00
Will Leinweber
b5d09afef5 Adds attribute protection to properties
Public Facing
   * through either :protected or :accessible8 flags
   * prevents protected attributes from being set in mass assignment
 Developer Facing
   * refactors #initialize and #update_attribute_without_saving
       to use same private methods to set attributes on ExtendedDocument
   * adds new mixin to do protection

Signed-off-by: Tapajós <tapajos@gmail.com>
2009-10-31 09:56:58 -02:00
Tapajós
d4010ad76e I think that init_method is more semantic that send. 2009-10-31 09:53:50 -02:00
Julien Sanchez
b5d6baaf11 Save on Document & ExtendedDocument crashed if bulk
- document#save expects to receive {"ok" => true} even with bulk mode
- ExtendedDocument#save_without_callbacks reverted to previous code
  (expecting result["ok"] as in create_without_callbacks)
2009-10-18 01:59:31 +08:00
Tapajós
2f2c507582 Merge remote branch 'tapajos/master'
Conflicts:
	README.md
	lib/couchrest/mixins/properties.rb
	spec/couchrest/core/database_spec.rb
	spec/couchrest/more/extended_doc_spec.rb
2009-09-20 22:52:39 -03:00
Tapajós
3c2ebb022d Merge remote branch 'remotes/old/master'
Conflicts:
	README.md
	couchrest.gemspec
	lib/couchrest.rb
	lib/couchrest/mixins/properties.rb
2009-09-03 23:10:06 -03:00
Tapajós
8db522a116 Fix issue #1. 2009-09-03 00:27:04 -03:00
Matt Aimonetti
a3cc649616 last touch up before merging all the 0.4 changes 2009-08-24 17:12:13 -07:00
Matt Aimonetti
64a51b73ae merged Peter's stuff 2009-08-24 16:57:58 -07:00
Luke Burton
2057e59777 To address http://github.com/couchrest/couchrest/issues/#issue/2, we simply remove the check on the value returned by database.save_doc. Errors from RestClient or CouchDB itself will be propagated as exceptions, which an upstream client should handle for themselves. 2009-08-20 12:25:12 -07:00
Peter Gumeson
1938270d65 Merge commit 'mattetti/master' 2009-08-12 16:48:13 -07:00
Matt Aimonetti
a17df45fc3 made all the specs run on 1.9.2, yay :) 2009-08-01 14:21:18 -07:00
Matt Aimonetti
9141669df1 extracted the rest API to its own module 2009-07-29 18:32:34 -07:00
wildchild
e4ad16b77c Use Time#mktime_with_offset 2009-07-21 09:31:18 +06:00
wildchild
16d9e819d7 Added typecasting of properties 2009-07-21 03:17:27 +06:00
Peter Gumeson
e87c543b0f reunited some __FILE__, __LINE__ with their + 1 2009-07-19 01:23:51 -07:00
Peter Gumeson
1e44302d1a Merge commit 'mattetti/master' 2009-07-19 00:01:07 -07:00
Peter Gumeson
7bae8acc36 Merge branch 'new_callbacks' 2009-07-18 23:37:16 -07:00
Matt Aimonetti
5140899041 Added ExtendedDocument.create({}) and #create!({}) so you don't have to do Model.new.create 2009-07-17 00:12:33 -07:00
John Wood
cf76466795 Added Collection mixin.
The Collection mixin adds support for executing a view, and passing
back the view results as an Array of the given ExtendedDocument instance.
It also supports will_paginate like pagination methods (paginate, paginated_each),
which will only fetch the given set of documents from CouchDB.
2009-07-08 09:38:26 -07:00
Seth Ladd
92d7fdb94d refactoring how casting works 2009-06-09 18:02:04 -10:00
Seth Ladd
ffceaec57d add silent settings for created_at and updated_at, allows for mass assignment with semantics that match rails 2009-06-08 16:34:21 -10:00
Peter Gumeson
806a79a72a Enabled callback halting and added copyright notices 2009-06-07 14:52:23 -07:00
Peter Gumeson
dc4787e905 Integrated Yehuda's new callback code from rails 2009-06-07 02:57:22 -07:00
Peter Gumeson
76b1563539 Renamed new_document? and new_model? to simply new? 2009-06-04 20:44:44 -07:00
Peter Gumeson
b4e2250668 Added validation callbacks to extended documents and casted models 2009-06-04 19:49:10 -07:00
Peter Gumeson
91cd1d9c7b base_doc should be nil for unassociated casted models 2009-05-30 23:20:39 -07:00
Peter Gumeson
d012380b67 Added helper for accessing the top level document. And more rails compatibility. 2009-05-28 22:42:30 -07:00
Peter Gumeson
936ce54449 Merge branch 'mattetti/master' 2009-05-28 22:31:20 -07:00
Matt Aimonetti
28df50daca minor text edit, trying to get github to build the gem 2009-05-28 19:41:30 -07:00
Peter Gumeson
efeb654114 casted_by is now set on assignment to a document. 2009-05-28 17:56:42 -07:00
Peter Gumeson
3e4c90f104 Fixed a comment 2009-05-28 17:00:06 -07:00
Peter Gumeson
23341f3698 Added new_model? and new_record? alias to casted model for rails compatibility. 2009-05-28 16:09:53 -07:00
Peter Gumeson
4a4cae0d95 Merge branch 'mattetti/master' 2009-05-28 11:30:15 -07:00
Matt Aimonetti
5e0632c1d0 removed ObjectSpace usage 2009-05-28 10:36:25 -07:00
Matt Aimonetti
295c0f0511 fixed the design doc cache issue 2009-05-27 23:59:43 -07:00
Matt Aimonetti
c35c35157a added an automated way to mark design docs as dirty after the db was reset 2009-05-27 18:16:50 -07:00
Peter Gumeson
704d0a09bd Added attributes= to casted model and extended doc 2009-05-27 13:24:25 -07:00
Matt Aimonetti
e48a6c8866 fixed all the specs so we are back to green 2009-05-26 18:27:49 -07:00
Eric Watson
a1087b48fe Enabled casting of CastedModel attributes 2009-05-26 15:55:10 -07:00