diff --git a/Gemfile.lock b/Gemfile.lock
index 683cfb2ea6..25d8376de2 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- avo (3.17.5)
+ avo (3.17.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
diff --git a/app/components/avo/fields/radio_field/edit_component.html.erb b/app/components/avo/fields/radio_field/edit_component.html.erb
index cd84ac7316..b2973ff799 100644
--- a/app/components/avo/fields/radio_field/edit_component.html.erb
+++ b/app/components/avo/fields/radio_field/edit_component.html.erb
@@ -2,8 +2,8 @@
<% @field.options.each do |key, value| %>
- <%= form.radio_button @field.id, key %>
- <%= form.label @field.id, value, value: value %>
+ <%= form.radio_button @field.id, key, checked: (@field.value.to_s == key.to_s) %>
+ <%= form.label @field.id, value, value: key %>
<% end %>
diff --git a/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock b/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock
index 29a15b67da..748406f3a3 100644
--- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock
+++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock
@@ -6,7 +6,7 @@ PATH
PATH
remote: ..
specs:
- avo (3.17.5)
+ avo (3.17.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
diff --git a/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock b/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock
index cb8d576965..1dc46ee855 100644
--- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock
+++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock
@@ -6,7 +6,7 @@ PATH
PATH
remote: ..
specs:
- avo (3.17.5)
+ avo (3.17.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
diff --git a/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock b/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock
index 66b63e37ba..17fc588859 100644
--- a/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock
+++ b/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock
@@ -6,7 +6,7 @@ PATH
PATH
remote: ..
specs:
- avo (3.17.5)
+ avo (3.17.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
diff --git a/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock b/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock
index 04b169de56..b16453ad51 100644
--- a/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock
+++ b/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock
@@ -6,7 +6,7 @@ PATH
PATH
remote: ..
specs:
- avo (3.17.5)
+ avo (3.17.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
diff --git a/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock b/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock
index 9da731cea3..86d5f7e19e 100644
--- a/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock
+++ b/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock
@@ -6,7 +6,7 @@ PATH
PATH
remote: ..
specs:
- avo (3.17.5)
+ avo (3.17.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
diff --git a/lib/avo/version.rb b/lib/avo/version.rb
index 4ff15f8f62..ed74c9ddca 100644
--- a/lib/avo/version.rb
+++ b/lib/avo/version.rb
@@ -1,3 +1,3 @@
module Avo
- VERSION = "3.17.5" unless const_defined?(:VERSION)
+ VERSION = "3.17.6" unless const_defined?(:VERSION)
end
diff --git a/spec/dummy/app/avo/actions/sub/dummy_action.rb b/spec/dummy/app/avo/actions/sub/dummy_action.rb
index 6f62505faa..f103b7d7cf 100644
--- a/spec/dummy/app/avo/actions/sub/dummy_action.rb
+++ b/spec/dummy/app/avo/actions/sub/dummy_action.rb
@@ -13,7 +13,7 @@ class Avo::Actions::Sub::DummyAction < Avo::BaseAction
end
def fields
- field :size, as: :radio, options: {small: "Small Option", medium: "Medium Option", large: "Large Option"}
+ field :size, as: :radio, options: {small: "Small Option", medium: "Medium Option", large: "Large Option"}, default: :medium
TestBuddy.hi("Dummy action fields")
field :keep_modal_open, as: :boolean
field :persistent_text, as: :text
diff --git a/spec/features/avo/radio_field_spec.rb b/spec/features/avo/radio_field_spec.rb
index b8182deeed..eea6df7f31 100644
--- a/spec/features/avo/radio_field_spec.rb
+++ b/spec/features/avo/radio_field_spec.rb
@@ -75,7 +75,12 @@
expect(page).to have_text("Small Option")
expect(page).to have_text("Medium Option")
+ expect(page).to have_checked_field("fields_size_medium")
expect(page).to have_text("Large Option")
+
+ find("label[for='fields_size_large']").click
+ expect(page).not_to have_checked_field("fields_size_medium")
+ expect(page).to have_checked_field("fields_size_large")
end
end
end