"Undefined Attribute Method"

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:

Yeni Basvuru


2:
3: <% form_for @candidate do |t|%>
4:

5: <%= t.label :name,“Isim”%>
6: <%= t.text_field :name%>

Please help me out!

On Mar 26, 4:56pm, Mistral C. [email protected] wrote:

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"

On Mar 26, 5:56pm, Mistral C. [email protected] wrote:

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

Thanks a lot Fred!!

That “class” attribute is probably your problem.

On Sat, Mar 26, 2011 at 6:56 PM, Mistral C.

Please post your model code

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs