rails_bootstrap_form 0.9.6 → 0.9.7

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
2
  SHA256:
3
- metadata.gz: c71affc7b54a85ee1b7d1515c5124e1c337470bb1ccb16bb22b82b9f56342d84
4
- data.tar.gz: dc88fb2396c94e92cb9516f1b65ba8e03c1e768f1c337241a74177227d7c497a
3
+ metadata.gz: 3ffc0cdcd818f57b7e0b683ec59b2ac3a59b80edab6e40f9eebe1da8d32cd376
4
+ data.tar.gz: 676be2383b1d1421b70a50ad5dc044eed15dfe4707b26ca345077644de9abebc
5
5
  SHA512:
6
- metadata.gz: 20e03576472e57b9d643eaa6b433a0cddb7e219271d14978de48b1175ce9b06422442240c9027719061b4e499b48a080010a9bca9deeb4bba34b013675bf7e91
7
- data.tar.gz: b0038b7c98be63e6b97a2b256aa2a733d30241349f534312ec2222e40923824bf5c4e765d8946965ca03198640e4b41dc9ed02c05738522aca6f78b651cedf59
6
+ metadata.gz: cdf31544bc3fd0032dff7b12bb95b1af33466d8e5a199ea0ecd263e1a8cdfdc2d00b02cc95425a1e712c6f2edd8ca626cf5e9ca6523fdf7eecf66a5a4776b17e
7
+ data.tar.gz: 60e72524a66706827e25fd018ffbe4dc75e823d346a86627c525e0e9f095af6a490846dc04526127708f4c30811f59c30c94b32936543055dcc6bf2fd6a3af4f
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ You can find recent releases with docs in GitHub:
4
4
 
5
5
  https://github.com/shivam091/rails_bootstrap_form/releases
6
6
 
7
+ ## [0.9.7](https://github.com/shivam091/rails_bootstrap_form/compare/v0.9.6...v0.9.7) - 2023-06-26
8
+
9
+ ### What's new
10
+
11
+ - Added specs for field helpers to ensure validation errors are rendered correctly in each layout.
12
+
7
13
  ## [0.9.6](https://github.com/shivam091/rails_bootstrap_form/compare/v0.9.5...v0.9.6) - 2023-06-25
8
14
 
9
15
  ### What's new
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_bootstrap_form (0.9.6)
4
+ rails_bootstrap_form (0.9.7)
5
5
  actionpack (~> 7.0)
6
6
  activemodel (~> 7.0)
7
7
 
@@ -0,0 +1,11 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class AdminUser
6
+ include ActiveModel::Model
7
+
8
+ attr_accessor :email, :password
9
+
10
+ validates :email, :password, presence: true
11
+ end
@@ -0,0 +1,13 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class SuperUser
6
+ attr_accessor :email, :password
7
+
8
+ def initialize(attributes = {})
9
+ attributes.each do |name, value|
10
+ send("#{name}=", value)
11
+ end
12
+ end
13
+ end
@@ -29,7 +29,7 @@ module RailsBootstrapForm
29
29
  end
30
30
 
31
31
  def has_association_error?(attribute)
32
- object.class.reflections.any? do |association_name, association|
32
+ object.class.try(:reflections)&.any? do |association_name, association|
33
33
  next unless is_belongs_to_association?(association)
34
34
  next unless is_association_same?(attribute, association)
35
35
 
@@ -40,7 +40,7 @@ module RailsBootstrapForm
40
40
  def error_messages(attribute)
41
41
  messages = object.errors[attribute]
42
42
 
43
- object.class.reflections.each do |association_name, association|
43
+ object.class.try(:reflections)&.each do |association_name, association|
44
44
  next unless is_belongs_to_association?(association)
45
45
  next unless is_association_same?(attribute, association)
46
46
 
@@ -48,7 +48,7 @@ module RailsBootstrapForm
48
48
  end
49
49
 
50
50
  def is_required_association?(target, attribute)
51
- target.reflections.find do |name, a|
51
+ target.try(:reflections)&.find do |name, a|
52
52
  next unless a.is_a?(ActiveRecord::Reflection::BelongsToReflection)
53
53
  next unless a.foreign_key == attribute.to_s
54
54
 
@@ -3,6 +3,6 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module RailsBootstrapForm
6
- VERSION = "0.9.6".freeze
6
+ VERSION = "0.9.7".freeze
7
7
  REQUIRED_RAILS_VERSION = "~> 7.0".freeze
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_bootstrap_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harshal LADHE (shivam091)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-25 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: generator_spec
@@ -86,11 +86,13 @@ files:
86
86
  - demo/app/jobs/application_job.rb
87
87
  - demo/app/mailers/application_mailer.rb
88
88
  - demo/app/models/address.rb
89
+ - demo/app/models/admin_user.rb
89
90
  - demo/app/models/application_record.rb
90
91
  - demo/app/models/city.rb
91
92
  - demo/app/models/country.rb
92
93
  - demo/app/models/fruit.rb
93
94
  - demo/app/models/skill.rb
95
+ - demo/app/models/super_user.rb
94
96
  - demo/app/models/user.rb
95
97
  - demo/app/models/user_skill.rb
96
98
  - demo/app/views/active_storage/blobs/_blob.html.erb