carmen-rails
carmen-rails copied to clipboard
undefined method `to_region_select_tag'
Dear all
I'm sorry if my error sound silly. I'm getting this error while implementing carmen on my rails app:
undefined method
to_region_select_tag' for #ActionView::Helpers::Tags::Base:0x5d83a18
`
this is my form code ` <%= simple_form_for @practitioner do |f| %> <% if practitioner.errors.any? %>
<%= pluralize(practitioner.errors.count, "error") %> prohibited this practitioner from being saved:
<ul>
<% practitioner.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
Are you using Rails 5? I am upgrading my app to Rails 5.1 and I'm getting this same error ... :/
Hi @RashedKhalfan & @Onikoroshi
It looks like the maintainer is no longer maintaining the gem (as of 3 years ago). Unfortunately the gem also does not specify an incompatibility with Rails 5.
If you'd like, you're more than welcome to the patched version I've made. Just update your gemfile with:
gem 'carmen-rails', git: '[email protected]:Studiosity/carmen-rails.git'
I'd suggest you take a look at the difference to understand why it didn't work:
https://github.com/carmen-ruby/carmen-rails/compare/master...Studiosity:master
The basic gist is that the to_region_select_tag
method is defined based on the rails version (either 3 or 4). My change adds support for 5, as well as handling a deprecation of one of the internal helper methods
Enjoy
@abrom I should have used;
gem 'carmen-rails', :git => 'https://github.com/Studiosity/carmen-rails.git', :branch => 'master'
to use it with heroku
FYI i've created a branch to also add support for Rails 6. I can't see any breaking changes from 5 to 6 so the update was pretty minimal.
https://github.com/Studiosity/carmen-rails/tree/rails-6
I'm going to continue testing and if everything looks good I'll merge it down to the master branch
@abrom Thank you very much!! I resolved the issue using your code:-D