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?
You need to install country_select as plugin in order for it to work. I believe an error should have been raised.
will be nice to have this on documentation at installation section, will help others to don't fall in this problem :)
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
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
@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
@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.
@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.
@kakubei you can specify string input with :as => :string
@nashby thanks so much, how dumb of me! :P
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" ?
@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.
Most helpful comment
@kakubei you simply need to pass the new type:
It is documented and there is a huge table in the README.