basic_model 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +22 -14
  2. data/lib/basic_model.rb +3 -4
  3. metadata +7 -9
data/README.md CHANGED
@@ -1,22 +1,30 @@
1
1
  # BasicModel
2
2
 
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.
3
+ BasicModel is intended to be used in a tableless model in Rails >= 3.0. It complies with the ActiveModel API and includes validations, so it can be used in form helpers without a problem.
4
4
 
5
- ## Usage
5
+ ## Installation
6
6
 
7
- gem install basic_model
8
-
9
- # Gemfile
10
- gem 'basic_model'
7
+ ```
8
+ gem install basic_model
9
+ ```
10
+
11
+ ## Usage
11
12
 
12
- # models/message.rb
13
- class Message
14
- include BasicModel
15
- attr_accessor :name, :email, :content
16
-
17
- # can even include validations
18
- validates_presence_of :name
19
- end
13
+ ```ruby
14
+ require 'basic_model'
15
+
16
+ class Message
17
+ include BasicModel
18
+ attr_accessor :name, :email, :content
19
+
20
+ # can even include validations
21
+ validates_presence_of :name
22
+ end
23
+
24
+ message = Message.new(:email => 'foo', :content => 'bar')
25
+ message.valid?
26
+ message.errors[:name] # => ['can't be blank']
27
+ ```
20
28
 
21
29
  ## Copyright
22
30
 
data/lib/basic_model.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'active_model/conversion'
2
- require 'active_model/validations'
1
+ require 'active_model'
3
2
  require 'active_support/concern'
4
3
 
5
4
  module BasicModel
@@ -9,11 +8,11 @@ module BasicModel
9
8
 
10
9
  def initialize(attributes = {})
11
10
  attributes.each do |name, value|
12
- send("#{name}=", value)
11
+ send "#{name}=", value
13
12
  end unless attributes.nil?
14
13
  end
15
14
 
16
15
  def persisted?
17
16
  false
18
17
  end
19
- end
18
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basic_model
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pete Browne
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-04 00:00:00 Z
18
+ date: 2011-07-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activemodel
@@ -29,8 +29,7 @@ dependencies:
29
29
  segments:
30
30
  - 3
31
31
  - 0
32
- - 0
33
- version: 3.0.0
32
+ version: "3.0"
34
33
  type: :runtime
35
34
  version_requirements: *id001
36
35
  - !ruby/object:Gem::Dependency
@@ -45,8 +44,7 @@ dependencies:
45
44
  segments:
46
45
  - 3
47
46
  - 0
48
- - 0
49
- version: 3.0.0
47
+ version: "3.0"
50
48
  type: :runtime
51
49
  version_requirements: *id002
52
50
  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.
@@ -90,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
88
  requirements: []
91
89
 
92
90
  rubyforge_project: basic_model
93
- rubygems_version: 1.7.1
91
+ rubygems_version: 1.8.5
94
92
  signing_key:
95
93
  specification_version: 3
96
94
  summary: BasicModel is a tiny Module that complies with the ActiveModel API