use*_*458 0 ruby activerecord ruby-on-rails nameerror rails-activerecord
我在执行应用程序时遇到此NameError.
NameError in CountriesController#index
undefined local variable or method `country_code' for Country(id: integer, name: string, country_code: string):Class
Run Code Online (Sandbox Code Playgroud)
这是代码中的某个地方,但我不明白.我有我的country_code,但它说它不存在.
class Country < ActiveRecord::Base
validates country_code, presence: true
validates name, presence: true
has_and_belongs_to_many :groups
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这一问题?
class Country < ActiveRecord::Base
validates :country_code, presence: true
validates :name, presence: true
has_and_belongs_to_many :groups
Run Code Online (Sandbox Code Playgroud)
您需要创建变量符号
归档时间: |
|
查看次数: |
67 次 |
最近记录: |