Cannot create/edit user: undefined method `country_select'

192 views
Skip to first unread message

Ken Chong

unread,
Dec 16, 2008, 10:09:15 AM12/16/08
to Webvz: OpenVZ Web Management Tool
Hello, me again :)

Unfortunately another error occurred, while adding/editing users:

===== Error message start =====

NoMethodError in User#new
Showing app/views/user/_form.rhtml where line #24 raised:

undefined method `country_select' for #<ActionView::Base:0xb76f7004>

Extracted source (around line #24):

21: <tr>
22: <td><label for="user_country">Country</label></td>
23: <td> : </td>
24: <td> <%= country_select 'user', 'country', "choose country" %> </
td>
25: </tr>
26: <tr>
27: <td><label for="user_email"> E-mail</label></td>


Trace of template inclusion: app/views/user/new.rhtml

RAILS_ROOT: /usr/rorapp/webvz.2.0

Application Trace | Framework Trace | Full Trace
app/views/user/_form.rhtml:24
app/views/user/new.rhtml:6
app/views/user/new.rhtml:4
/usr/local/bin/mongrel_rails:19:in `load'
/usr/local/bin/mongrel_rails:19

===== Error message end =====

Ken

Shuaib Zahda

unread,
Dec 17, 2008, 1:01:45 AM12/17/08
to we...@googlegroups.com
Hi

I have googled this because it is strange. I found out that it has been deprecated from rails 2.2 which is really strange. Anyway, to get it running you have 2 ways

1. if you do not need the country of the user what you need to do is to comment out the whole line by adding # like this

<%#= country_select 'user', 'country', "choose country" %>

2. in case you want the country option, you need to do some little ruby installation to meet the new rails

go to webvz directory and copy the following command in the shell

# ruby script/plugin install git://github.com/ihower/country_and_region_select.git

and restart the sever

I wish this will work

sorry for the changes that were caused by the main developers of rails
--
Shuaib Zahda
www.shobiddak.com

Ken Chong

unread,
Dec 24, 2008, 9:09:02 AM12/24/08
to Webvz: OpenVZ Web Management Tool
Hi,

It seems that the program don't like an empty country, so I added:

<input type="hidden" name="user[country]" value="(none)">

Any value should be fine.

Also _editForm.html.erb in the same directory need the same
modification.


Wish you a Merry Christmas!

Ken
Reply all
Reply to author
Forward
0 new messages