relaxo-model 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 111d2212cc180cfad8ca53997c1a03722559694b
4
- data.tar.gz: 5b37cb150db297bd854dca03c63101e9421f01a5
3
+ metadata.gz: 44f11570609589c888e40f305a664aa537818a89
4
+ data.tar.gz: a3b2fb07a3f52c10bb4e9bdb399e6276c33584d5
5
5
  SHA512:
6
- metadata.gz: 41532378165e1cbe27bd01ad15ca6274ab2c91c0d84f359af78cc0f83996d165692fc47cd228443f69e90a8d53d986d6d545f3b3588346c3fb618f71b17ebf2a
7
- data.tar.gz: 9711fc150ce1e2b82f72b6249d193c84b73485ac175927c560697d3a768ff8785763dabdba2a690a9ab6554deeb888a1bbb383c04c17b40c5d34c45672a53382
6
+ metadata.gz: bfb74b336947a27ef3f629aae18fb5fa715aaa1ea850e8efeb49315e2974131784d9f411e8aed19f4e9c3de30b24f8e3302b05b59cd910443389b53857cb74f3
7
+ data.tar.gz: e7e504bae3167ce7d62ecefbf674134e68ab63feb906917bb35f64c4c628e237927d9e1ebde6bf0161407b93a00c79dab94598fb093b5b5d10ec2334c6d170b2
data/README.md CHANGED
@@ -1,16 +1,8 @@
1
- Relaxo Model
2
- ============
3
-
4
- * Author: Samuel G. D. Williams (<http://www.oriontransfer.co.nz>)
5
- * Copyright (C) 2010, 2011 Samuel G. D. Williams.
6
- * Released under the MIT license.
1
+ # Relaxo Model
7
2
 
8
3
  Relaxo Model provides a framework for business logic on top of Relaxo/CouchDB. While it supports some traditional ORM style patterns, it is primary focus is to model business processes and logic.
9
4
 
10
- * This framework is pretty experimental right now and subject to change. Incompatible changes will be marked by the version number `x.y.z`, where changes in `x` indiciate fundamental API changes and changes in `y` indicate minor changes or additions that shouldn't cause breakage. *
11
-
12
- Basic Usage
13
- -----------
5
+ ## Basic Usage
14
6
 
15
7
  Here is a simple example of a traditional ORM style model:
16
8
 
@@ -67,10 +59,19 @@ If the design document was saved as `catalog.yaml`, you could load it using rela
67
59
 
68
60
  relaxo test catalog.yaml
69
61
 
70
- License
71
- -------
62
+ ## Contributing
63
+
64
+ 1. Fork it
65
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
66
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
67
+ 4. Push to the branch (`git push origin my-new-feature`)
68
+ 5. Create new Pull Request
69
+
70
+ ## License
71
+
72
+ Released under the MIT license.
72
73
 
73
- Copyright (c) 2010, 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
74
+ Copyright, 2010-2013, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
74
75
 
75
76
  Permission is hereby granted, free of charge, to any person obtaining a copy
76
77
  of this software and associated documentation files (the "Software"), to deal
@@ -84,6 +84,10 @@ module Relaxo
84
84
  @attributes.key? ID
85
85
  end
86
86
 
87
+ def changed? key
88
+ @changed.include? key.to_s
89
+ end
90
+
87
91
  def rev
88
92
  @attributes[REV]
89
93
  end
@@ -100,7 +100,7 @@ module Relaxo
100
100
  class HasMany < HasOne
101
101
  def convert_to_primative(value)
102
102
  value.each do |document|
103
- document.save unless value.id
103
+ document.save unless document.saved?
104
104
  end
105
105
 
106
106
  value.collect{|document| document.id}
@@ -33,9 +33,10 @@ module Relaxo
33
33
 
34
34
  attr :klass
35
35
  attr :database
36
-
36
+ attr :view
37
+
37
38
  def count
38
- @view["total_rows"]
39
+ rows.count
39
40
  end
40
41
 
41
42
  def offset
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Relaxo
22
22
  module Model
23
- VERSION = "0.4.0"
23
+ VERSION = "0.4.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaxo-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-01 00:00:00.000000000 Z
11
+ date: 2013-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler