你好,請我有一個模範學生,其中有一個字段調用admission_end:日期我想定義一個範圍,幫我拿所有的學生誰是接納爲結束那一天它試試這個,但我的問題是如何使其顯示我的觀點如何定義範圍,讓它的意見sgow
這是我的範圍定義
attr_accessible :address, :address, :admission_ends, :certificate, :country, :date_of_birth, :diploma_id, :email, :first_name, :full_name, :gender, :how_did_you_hear_about_us, :lg_area, :middle_name, :other, :relationship_with_applicant, :state_of_origin, :surname, :telephone_number, :telephone_number, :title, :title, :image, :amount_deposit, :balance, :full_payment, :next_payment, :part_payment, :programme, :mode_of_payment
belongs_to :admin
mount_uploader :image, ImageUploader
belongs_to :diploma
belongs_to :payment
scope :admission_due, -> { where("students.admission_ends >= ?", Date.today) }
[Rü試圖找到學生誰是接納爲結束那一天併發送哈希意見記錄? – Debadatt
是的,這正是我需要 –
你可以得到所有的學生與範圍,並在控制器方法寫成 @students = Student.admission_due – Debadatt