carmen-rails icon indicating copy to clipboard operation
carmen-rails copied to clipboard

undefined method `to_region_select_tag'

Open RashedKhalfan opened this issue 7 years ago • 5 comments

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 %>


`

RashedKhalfan avatar May 22 '17 11:05 RashedKhalfan

Are you using Rails 5? I am upgrading my app to Rails 5.1 and I'm getting this same error ... :/

Onikoroshi avatar Sep 19 '17 02:09 Onikoroshi

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 avatar Jan 26 '18 09:01 abrom

@abrom I should have used; gem 'carmen-rails', :git => 'https://github.com/Studiosity/carmen-rails.git', :branch => 'master' to use it with heroku

afelopez avatar Dec 27 '18 17:12 afelopez

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 avatar Oct 27 '19 13:10 abrom

@abrom Thank you very much!! I resolved the issue using your code:-D

milky-airi avatar Sep 03 '23 06:09 milky-airi