Ruby on Rails Wednesday, August 1, 2012

Hello,


Your class Project does not have a method by the name 'id'. Please review the logic of your code :-)

On Tuesday, July 31, 2012 2:30:22 PM UTC+3, Ruby-Forum.com User wrote:
I have installed the latest version of rails and jruby. I have copied
all my files from rails 2.3.5 version and am trying to bring all to work
in this version

Project.rb
------------------
class Project < ActiveRecord::Base
 has_and_belongs_to_many :people
 has_many :documents, :conditions => ["project_id =?", self.id ]
..
..
end

application_helper.rb
--------------------------

def find_projects
    user = Person.find(session[:userid])
   projects = Project.find(:all)
   ..
..
..
end

I am getting an error
undefined method `id' for #<Class:0x182237ac>  (self.id is the problem
guess)

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Qo4e7fUbtEQJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment