I couldn't find any other source to solve my problem, so I'm posting
here I have a controller "candidates"
class CandidatesController < ApplicationController
def new
@candidate = Candidate.new
end
end
A table model called candidate with lots of validations.
I create my new.html.erb and whenever I try to open it I get this
error message:
undefined method `define_attribute_methods' for nil:NilClass
Extracted source (around line #3):
1: <h1>Yeni Basvuru</h1>
2:
3: <% form_for @candidate do |t|%>
4: <div>
5: <%= t.label :name,"Isim"%>
6: <%= t.text_field :name%>
Please help me out!
I couldn't find any other source to solve my problem, so I'm posting
here I have a controller "candidates"
class CandidatesController < ApplicationController
def new
@candidate = Candidate.new
end
end
A table model called candidate with lots of validations.
I create my new.html.erb and whenever I try to open it I get this
error message:
I'd say that the most likely problem is that you've managed to define
a method (or have an attribute with a name) that clashes with a
standard ruby or activerecord method.
Do you have a method or column named class by any chance?
Fred
I'd say that the most likely problem is that you've managed to define
a method (or have an attribute with a name) that clashes with a
standard ruby or activerecord method.
Do you have a method or column named class by any chance?
Fred
I have these:
t.string "name"
t.string "surname"
t.string "email"
t.integer "tc_id"
t.datetime "birthday"
t.integer "cellphone"
t.integer "localphone"
t.boolean "gender"
t.string "school"
t.string "class"
t.text "address"
t.boolean "accommodation"
t.boolean "scholarship"
t.text "other"
t.text "arrival"
t.text "condition"
t.text "reference"
t.string "parent_n"
t.string "parent_s"
t.integer "parent_p"
t.string "parent_e"
t.string "alt_name"
t.integer "alt_phone"
t.boolean "attendance"
t.string "which_event"
t.boolean "attendance_p"
t.string "which_camp"
t.text "expectation"
t.string "source"
t.boolean "terms"
t.datetime "created_at"
t.datetime "updated_at"
That “class” attribute is probably your problem.
> I'd say that the most likely problem is that you've managed to define
> a method (or have an attribute with a name) that clashes with a
> standard ruby or activerecord method.
> Do you have a method or column named class by any chance?
I have these:
t\.string "school"
t\.string "class"
That would be a yes then.
Fred