diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4dc24aa7..1f218308a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@ Bugfixes:
- Use #underscore, not #downcase for help text scope (#140, @atipugin)
- Radio button and checkbox labels will now include the disabled class as needed. (#156, @ScottSwezey)
+ - Can't override primary button classes (#183, @tanimichi)
Features:
diff --git a/lib/bootstrap_form/helpers/bootstrap.rb b/lib/bootstrap_form/helpers/bootstrap.rb
index 0dac054b6..44bc6d816 100644
--- a/lib/bootstrap_form/helpers/bootstrap.rb
+++ b/lib/bootstrap_form/helpers/bootstrap.rb
@@ -2,12 +2,12 @@ module BootstrapForm
module Helpers
module Bootstrap
def submit(name = nil, options = {})
- options.merge! class: 'btn btn-default' unless options.has_key? :class
+ options.reverse_merge! class: 'btn btn-default'
super(name, options)
end
def primary(name = nil, options = {})
- options.merge! class: 'btn btn-primary'
+ options.reverse_merge! class: 'btn btn-primary'
submit(name, options)
end
diff --git a/test/bootstrap_other_components_test.rb b/test/bootstrap_other_components_test.rb
index 5b2258100..b86fb9d63 100644
--- a/test/bootstrap_other_components_test.rb
+++ b/test/bootstrap_other_components_test.rb
@@ -51,4 +51,9 @@ def setup
expected = %{}
assert_equal expected, @builder.primary("Submit Form")
end
+
+ test "override primary button classes" do
+ expected = %{}
+ assert_equal expected, @builder.primary("Submit Form", class: "btn btn-primary disabled")
+ end
end