It gets stranger.

The error message says:
      Mysql::Error: Unknown column 'users.enroller_id' in 'where
clause': SELECT `users`.id FROM `users` WHERE (`users`.`id` = 13) AND
(`users`.enroller_id = -616251098)  LIMIT 1


But if I cut the sql and paste it into the mysql app:

SELECT `users`.id FROM `users` WHERE (`users`.`id` = 1) AND
(`users`.enroller_id = -616166838);

I get:
Empty set (0.00 sec)

Which I expect because I am doing TDD and I have not implemented the
code to do the link yet.

Not sure where the problem is, but there is definitely something weird
going on :(


Geoff


On Jul 6, 6:48 pm, geoffd123 <[email protected]> wrote:
> :)
>
> As per my comment before, yes.
>
> Cheers
> Geoff
>
> On Jul 6, 3:33 pm, Tiago Franco <[email protected]> wrote:
>
> > Geof,
>
> > Is the neroller_id column present in the users table?
>
> > Regards,
> >   Tiago Franco
>
> > On Jul 6, 6:32 am, geoffd123 <[email protected]> wrote:
>
> > > Hi All
>
> > > I have a User model with the following definition:
>
> > >  fields do
> > >     name :string
> > >     email_address :email_address, :unique, :login => true
> > >     administrator :boolean, :default => false
> > >     sponsor_code  :string, :unique
> > >     paypal_email :email_address
> > >     minimum_amount :decimal
> > >     timestamps
> > >   end
>
> > >   has_many :subscribers
> > >   has_many :commission_paids
> > >   has_many :affiliates, :class_name => 'User', :foreign_key =>
> > > 'enroller_id'
> > >   belongs_to :enroller , :class_name => 'User'
>
> > > The problem is with has_many affiliates.
>
> > > In my cucumber  test I have the lines
>
> > >   user1 = User.find_by_email_address(email1)
> > >   raise "User #{email1} is not in the database" if user1 == nil
>
> > >   user2 = User.find_by_email_address(email2)
> > >   raise "User #{email2} is not in the database" if user2 == nil
>
> > >   raise "No link between users" unless user1.affiliates.include?
> > > (user2)
>
> > > The last line causes a MySql exception:
>
> > >       Mysql::Error: Unknown column 'users.enroller_id' in 'where
> > > clause': SELECT `users`.id FROM `users` WHERE (`users`.`id` = 13) AND
> > > (`users`.enroller_id = -616251098)  LIMIT 1
> > > (ActiveRecord::StatementInvalid)
> > >       features/affiliates.feature:167:in `Then the database record for
> > > "[email protected]" should contain a link to "[email protected]"'
>
> > > enroller_id does appear in the users table
>
> > > Am I missing something in my definition to link enroller_id with
> > > affiliates?  Or is this a bug?
>
> > > Any help greatfully received!
>
> > > Cheers
> > > Geoff
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to