1
에 대해 정의되지 않은 메소드`boarding_eq '는 ransack에 이상한 오류가 있습니다. 오류가 반환됩니다.Ransack :: Search <class : School, base : Grouping <combinator : and >> : Ransack :: Search
undefined method `boarding_eq' for Ransack::Search<class: School, base: Grouping <combinator: and>>:Ransack::Search
;
<div class="form-group col-xs-6 pull-left">
<%= f.label :boarding_eq, " Boarding Facilities", class: 'search-label ' %>
<%= f.select :boarding_eq, options_for_select(["","Yes", "No"]), class: 'form-control col-xs-12' %>
</div>
그러나 다른 모든 입력에도 사용할 수 있습니다.
<div class="form-group col-xs-6 pull-left">
<%= f.label :year_of_establishment_eq, " Boarding Facilities", class: 'search-label ' %>
<%= f.select :year_of_establishment_eq, options_for_select(["","Yes", "No"]), class: 'form-control col-xs-12' %>
</div>
학교 모델은 다음과 같습니다.
class School < ActiveRecord::Base
attr_accessible :about, :academic_level, :country, :boarding, :district_or_province,
:email_address, :fees, :gender, :information_technology, :number_of_students,
:performing_arts, :phone_number, :photo_1, :photo_2, :photo_3, :photo_4,
:photo_5, :physical_address, :post_address, :school_name, :sports, :town,
:web_address, :year_of_establishment
validates :about, :academic_level, :country, :boarding, :district_or_province,
:email_address, :gender, :information_technology, :number_of_students,
:performing_arts, :phone_number, :physical_address, :post_address, :school_name,
:sports, :town, presence: true
validates :email, :with => /\A[A-Za-z0-9._%+-][email protected][A-Za-z0-9.-]+\.[A-Za-z]+\z/, uniqueness:true
validates :phone_number, uniqueness:true, numericality: true, length: {minimum: 12}
belongs_to :user
has_many :school_events
has_many :school_reviews
has_many :votes
has_one :rating
end
이고 모델 마이그레이션은 다음과 같습니다.
class CreateSchools < ActiveRecord::Migration
def change
create_table :schools do |t|
t.integer :user_id
t.string :school_name
t.integer :year_of_establishment
t.string :number_of_students
t.string :academic_level
t.string :phone_number
t.string :email_address
t.string :web_address
t.text :physical_address
t.integer :post_address
t.string :country
t.string :district_or_province
t.string :town
t.text :about
t.string :fees
t.string :sports
t.string :information_technology
t.string :performing_arts
t.string :gender
t.string :boarding
t.text :photo_1
t.text :photo_2
t.text :photo_3
t.text :photo_4
t.text :photo_5
t.timestamps
end
add_index :schools, [:user_id, :year_of_establishment]
add_index :schools, [:school_name, :number_of_students]
add_index :schools, [:academic_level, :country ]
add_index :schools, [ :district_or_province, :fees ]
add_index :schools, [:boarding, :gender ]
end
end
나는 학교 모델 및 학교 이전을 추가했습니다.
'학교'모델의 세부 정보를 표시하십시오. 또한 어떤 유형의 속성이'탑승'입니까? –
@GraemeMcLean, 나는 그들을 추가했습니다 – Acacia
왜이 필드가 마음에 들지 않는지 생각할 수 없지만 다른 모든 필드에서는 문제가 없습니다. 검색 엔진을 구축하거나 결과를 얻는 데 오류가 나타 납니까? 스택 트레이스에 유용한 다른 것이 있습니까? –