Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `to_region_select_tag' #62

Open
RashedKhalfan opened this issue May 22, 2017 · 5 comments
Open

undefined method `to_region_select_tag' #62

RashedKhalfan opened this issue May 22, 2017 · 5 comments

Comments

@RashedKhalfan
Copy link

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

<%= f.label :firstName %> <%= f.text_field :firstName %>
<%= f.label :LastName %> <%= f.text_field :LastName %>
<%= f.label :contactNum %> <%= f.text_field :contactNum %>
<%= f.label :country %>
<%= f.country_select :country, priority: %w(US CA), prompt: 'Please select a country' %>
<%= f.label :state %> <%= f.text_field :state %>
<%= f.label :location %> <%= f.text_field :location %>
<%= f.submit %>
<% end %> `
@Onikoroshi
Copy link

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

@abrom
Copy link

abrom commented Jan 26, 2018

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:

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

@afelopez
Copy link

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

@abrom
Copy link

abrom commented Oct 27, 2019

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

@milky-airi
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants