basic_model 0.1.1 → 0.2.0
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.
- data/README.md +4 -3
- data/lib/basic_model.rb +5 -3
- metadata +13 -10
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# BasicModel
|
2
2
|
|
3
|
-
BasicModel is intended to be used
|
3
|
+
BasicModel is intended to be used in a tableless model in Rails >= 3.0. It complies with the ActiveModel API and includes valdiations, so it can be used in form helpers without a problem.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -10,7 +10,8 @@ BasicModel is intended to be used as a tableless model in Rails. It complies wit
|
|
10
10
|
gem 'basic_model'
|
11
11
|
|
12
12
|
# models/message.rb
|
13
|
-
class Message
|
13
|
+
class Message
|
14
|
+
include BasicModel
|
14
15
|
attr_accessor :name, :email, :content
|
15
16
|
|
16
17
|
# can even include validations
|
@@ -19,4 +20,4 @@ BasicModel is intended to be used as a tableless model in Rails. It complies wit
|
|
19
20
|
|
20
21
|
## Copyright
|
21
22
|
|
22
|
-
Copyright (c)
|
23
|
+
Copyright (c) 2011 [Peter Browne](http://petebrowne.com). See LICENSE for details.
|
data/lib/basic_model.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
require 'active_model'
|
1
|
+
require 'active_model/conversion'
|
2
|
+
require 'active_model/validations'
|
3
|
+
require 'active_support/concern'
|
2
4
|
|
3
|
-
|
5
|
+
module BasicModel
|
6
|
+
extend ActiveSupport::Concern
|
4
7
|
include ActiveModel::Conversion
|
5
8
|
include ActiveModel::Validations
|
6
|
-
extend ActiveModel::Naming
|
7
9
|
|
8
10
|
def initialize(attributes = {})
|
9
11
|
attributes.each do |name, value|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basic_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Pete Browne
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2011-05-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activemodel
|
@@ -25,6 +25,7 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 7
|
28
29
|
segments:
|
29
30
|
- 3
|
30
31
|
- 0
|
@@ -40,6 +41,7 @@ dependencies:
|
|
40
41
|
requirements:
|
41
42
|
- - ~>
|
42
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 7
|
43
45
|
segments:
|
44
46
|
- 3
|
45
47
|
- 0
|
@@ -47,7 +49,7 @@ dependencies:
|
|
47
49
|
version: 3.0.0
|
48
50
|
type: :runtime
|
49
51
|
version_requirements: *id002
|
50
|
-
description: BasicModel is intended to be used
|
52
|
+
description: BasicModel is intended to be used in a tableless model in Rails >= 3.0. It complies with the ActiveModel API and includes valdiations, so it can be used in form helpers without a problem.
|
51
53
|
email: me@petebrowne.com
|
52
54
|
executables: []
|
53
55
|
|
@@ -59,7 +61,6 @@ files:
|
|
59
61
|
- lib/basic_model.rb
|
60
62
|
- LICENSE
|
61
63
|
- README.md
|
62
|
-
has_rdoc: true
|
63
64
|
homepage: http://github.com/petebrowne/basic_model
|
64
65
|
licenses: []
|
65
66
|
|
@@ -73,6 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
74
|
requirements:
|
74
75
|
- - ">="
|
75
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
76
78
|
segments:
|
77
79
|
- 0
|
78
80
|
version: "0"
|
@@ -81,15 +83,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
83
|
requirements:
|
82
84
|
- - ">="
|
83
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
84
87
|
segments:
|
85
88
|
- 0
|
86
89
|
version: "0"
|
87
90
|
requirements: []
|
88
91
|
|
89
92
|
rubyforge_project: basic_model
|
90
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.7.1
|
91
94
|
signing_key:
|
92
95
|
specification_version: 3
|
93
|
-
summary: BasicModel is a tiny
|
96
|
+
summary: BasicModel is a tiny Module that complies with the ActiveModel API
|
94
97
|
test_files: []
|
95
98
|
|