【发布时间】:2015-08-07 16:44:53
【问题描述】:
我无法将此选择国家/地区插件 (https://github.com/scudco/country_select_test) 集成到我的测试应用程序中。我安装了它并将其放入我的数据库中。当我在 Rails 控制台中输入我的 id 时,它会显示出来,但它总是显示为 nil。这是我的 view.haml:
.form-group
= f.input :country_code, autofocus: true, :class => "form-control"
.form-group
= f.input :address, autofocus: false, :class => "form-control"
这是我最近进行的迁移:
class AddCountryCodeToUsers < ActiveRecord::Migration
def change
add_column :users, :country_code, :string
end
end
我的控制台的输出:
updated_at: "2015-08-07 15:29:26", address: " ", country_code: nil>
我对 users.rb 文件中的 :country_code 一无所知。我曾经在他们的文件中有断言 country_code,但是当我把它拿出来时它并没有改变任何东西。感谢所有帮助我的人。我仍然是 ruby on rails 的菜鸟。
【问题讨论】:
标签: ruby-on-rails ruby database activerecord