OK, I got the relationship side of things sorted out for my rails application! class User < ActiveRecord::Base has_many :userevents has_many :events, :through => :userevents class Event < ActiveRecord::Base has_many :userevents has_many :users, :through => :userevents class Userevent < ActiveRecord::Base belongs_to :user belongs_to :event When I want to see what events a user belongs to, surely the following should work: Now, calling @user = User.find(params[:id]).events but not the case, it returns the following error: compile error c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1359: parse error, unexpected tINTEGER Object::1 ^ A google search gives something about using reserved words in my database table but (for the time being) the only columns that exist are id, user_id and event_id. I''m going crazy! Cheers Mike -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 3/12/07, Mike <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> When I want to see what events a user belongs to, surely the following > should work: > > Now, calling @user = User.find(params[:id]).events > > but not the case, it returns the following error: > > compile error > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1359: > parse error, unexpected tINTEGER > Object::1 > ^You have a type column in your database table. This is reserved for single-table inheritance. Rename it. jeremy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper wrote:> On 3/12/07, Mike <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> Object::1 >> ^ > > You have a type column in your database table. This is reserved for > single-table inheritance. Rename it. > > jeremyyep - found it, thanks for the help! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---