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

Already on GitHub? Sign in to your account

undefined method `country_select' for #<SimpleForm::FormBuilder:0x1039dd9c0> #54

Closed
wilkerlucio opened this Issue Sep 20, 2010 · 14 comments

Comments

Projects
None yet
7 participants
Contributor

wilkerlucio commented Sep 20, 2010

Hi, I'm using an clean setup of Rails 3 with SimpleForm, in tests and development I'm getting this error for a field labeled "country". It needs an extra manual setup to work? Also I mean this bug can be happening because I'm using Mongoid, the country select has any dependency on ActiveRecord directly? Or in end its a bug on version 1.2.2?

Owner

josevalim commented Sep 20, 2010

You need to install country_select as plugin in order for it to work. I believe an error should have been raised.

Contributor

wilkerlucio commented Sep 20, 2010

will be nice to have this on documentation at installation section, will help others to don't fall in this problem :)

Owner

josevalim commented Sep 20, 2010

Please update the docs and send me a pull request then!

Hi I tried both plugin and gem f country select but all in vain. Getting error when installed

ActionView::Template::Error (undefined method `country_select' for #ActionView::Helpers::FormBuilder:0x7fd7eaa1ad78):

can any one help and provide its Doc in help file about its useage :) thanks in advance

Friends I've found the answer of the question. I posted above. I did not restart the server after installing plugin. :) hurrra

kakubei commented May 9, 2012

I get the same error, but I'm not using the plugin, nor do I wan to use it, I simply want to grab all the countries from within a table I already have. This error is coming up because presumably simple_form is getting confused by the :country symbol and wants to call the plugin. I simply want to list what I've retrieved from my own countries table with a column called 'country'.

Surely there is a workaround for this?

As per my understanding after reading your question, you should get countries list from table in a variable then use that variable in select_tag instead of using simple_form

kakubei commented May 9, 2012

@taimoor018 Why would I need to do that, when all my other forms work? Is there no other workaround? Also, I get the same error using neste fields:

= simple_form_for @DVD do |f|
= f.simple_fields_for :dvd_country do |country_form|
= country_form.input :country

Owner

josevalim commented May 9, 2012

@kakubei you simply need to pass the new type:

= country_form.input :country :as => :select

It is documented and there is a huge table in the README.

kakubei commented May 9, 2012

@josevalim Thanks Jose, I didn't actually see that in the readme. What I want is a text field, so I'll use :as => text. Let me ask you, speaking of text, is there a way to specify a text input as opposed to textarea?

Again, I didn't see any option for that in the readme (just text which creates a textarea).

By the way, thanks for this wonderful gem it is truly fantastic. Muito obrigado.

Collaborator

nashby commented May 9, 2012

@kakubei you can specify string input with :as => :string

kakubei commented May 9, 2012

@nashby thanks so much, how dumb of me! :P

deesx commented Mar 8, 2013

Am I right to think that,

with the following :

= f.input :shipping_country, label: "blah blah", :wrapper_html => {:class => "field half right"}

and getting the following error :

undefined method `country_select' for #<SimpleForm::FormBuilder:0x007f87f3779f98>

your plugin is a little bit too strict on the transformation of the word "country" ?

Collaborator

carlosantoniodasilva commented Mar 8, 2013

@bbnnt it assumes a default which most people would use, which is the country select plugin, but it is flexible enough by allowing you to easily configure it to be different, completely ignoring country select. Check #757 for more info.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment