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! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 26, 4:56 pm, Mistral Contrastin <madgenhe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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> > 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!-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> 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? > > FredI 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" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
That "class" attribute is probably your problem. On Sat, Mar 26, 2011 at 6:56 PM, Mistral Contrastin <madgenhetic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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? > > > > 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" > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 26, 5:56 pm, Mistral Contrastin <madgenhe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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> 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"-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks a lot Fred!! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Please post your model code On Mar 26, 12:56 pm, Mistral Contrastin <madgenhe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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!-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.