activemodel-form 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cbe2f1670a51ce74f8a77eafd80bb1216da01782
4
- data.tar.gz: bcdf295cb55e85a2d1644b7a7b7467317ed8fbaf
2
+ SHA256:
3
+ metadata.gz: 5cf91abe302d75a952dc4897b2058e24bec7ee6443de82a0564b4f0891fd8e95
4
+ data.tar.gz: eabc9b8439ee54ee6fd0e99869f9b4185e01f32a16bd00b167386b320d2f7d12
5
5
  SHA512:
6
- metadata.gz: 5bb2bb5a4f8e899525983143e86ff970ba53d7d4df466607694d3805c2497b4ff53396a6e5dd0b8ad08abbe20c2ff2458f5d3d6d27c914dbb5a7a84cd5776fc8
7
- data.tar.gz: 5aeff6a3faa6b79ffb0aa6e7c63af0a8795c25d86ec2147a31789bb72de584d8616b0a0c8d7290458dc688da5226cd5c95b6febeedcdc5db5a47c2a26cb11ea7
6
+ metadata.gz: b980afdbf9e9799062657377c6155bcd1a29d861bc284ec49668bb113a75ae1f3078b1083399ce50b8c9bdd76b84c05a70c955a7615b0db105c01e05f4da9402
7
+ data.tar.gz: 06ecdc4e6853800b9e5fbdd32d423e3604e08f2092ec7bf58e650c8cae32a9eb961c5423a090caba43da1e788d2b08ff56335f6b4684bc18de540bff873549f8
@@ -1,7 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- - 1.9.2
6
- - rbx-19mode
7
- - ruby-head
3
+ - 2.5.0
@@ -1,3 +1,7 @@
1
+ #### 1.2.0
2
+
3
+ * Add has_attribute? method to conform to AR interface (#9)
4
+
1
5
  #### 1.1.0
2
6
 
3
7
  * Add support for parsing date params in ISO format (YYYY-MM-DD)
@@ -40,6 +40,10 @@ module ActiveModel
40
40
  self.class.attributes[name.to_s]
41
41
  end
42
42
 
43
+ def has_attribute?(name)
44
+ self.class.attributes[name.to_s].present?
45
+ end
46
+
43
47
  def assign_attributes(new_attributes)
44
48
  return if new_attributes.blank?
45
49
  new_attributes = self.clean_attributes(new_attributes)
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  class Form
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -0,0 +1,17 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe ActiveModel::Form do
4
+ it "implements the active_record interface" do
5
+ class Form < ActiveModel::Form
6
+ attribute :username, :string
7
+ end
8
+
9
+ form = Form.new(username: 'test')
10
+
11
+ form.column_for_attribute(:username).must_equal ActiveModel::Form::StringAttribute
12
+ form.column_for_attribute(:created_at).must_equal nil
13
+
14
+ form.has_attribute?(:username).must_equal true
15
+ form.has_attribute?(:created_at).must_equal false
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Schuerrer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-30 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -157,6 +157,7 @@ files:
157
157
  - lib/active_model/form/attributes.rb
158
158
  - lib/active_model/form/version.rb
159
159
  - lib/activemodel-form.rb
160
+ - spec/active_record_interface_spec.rb
160
161
  - spec/boolean_attribute_form_spec.rb
161
162
  - spec/date_time_form_spec.rb
162
163
  - spec/date_time_string_spec.rb
@@ -184,11 +185,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
185
  version: '0'
185
186
  requirements: []
186
187
  rubyforge_project:
187
- rubygems_version: 2.2.2
188
+ rubygems_version: 2.7.3
188
189
  signing_key:
189
190
  specification_version: 4
190
191
  summary: ''
191
192
  test_files:
193
+ - spec/active_record_interface_spec.rb
192
194
  - spec/boolean_attribute_form_spec.rb
193
195
  - spec/date_time_form_spec.rb
194
196
  - spec/date_time_string_spec.rb