Forum: Ruby on Rails is "alias" reserved?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-03-06 01:51
I'm playing with an online store....


I have an orders table which holds orders (pricing, statuses, etc).
An orderDetails table which holds detailed line items (itemNumbers, unit
prices, etc).

Each order can have multiple shipping addresses, so I also have
an addressbook table. Each orderDetail is tied to an addressbook entry
via the ordernumber and addressbook alias, but this doesn't seem to work
for me.

------
class OrderDetail < ActiveRecord::Base
set_table_name "orderDetails"
belongs_to :order, :foreign_key => 'orderNumber'
has_many :addressbooks, :finder_sql =>
      'SELECT * ' +
      'FROM addressbooks addr ' +
      'WHERE addr.orderNumber = "#{orderNumber}"' +
      'AND addr.alias = "#{alias}"'
end
------

I try to access the addressbook of a specific orderDetail (line item)
and it barfs.

------

(eval):1:in `instance_eval': compile error
(eval):1: syntax error
%@SELECT * FROM addressbooks addr WHERE addr.orderNumber =
"#{orderNumber}" AND addr.alias = "#{alias}"@
                                                                                                     ^
(eval):1: unterminated string meets end of file


------



Just wondering if the word "alias" is a reserved word
for either mysql or rails?

thanks!
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-06 01:57
(Received via mailing list)
Yeah, alias is a reserved word.

You might find
http://www.ilovejackdaniels.com/ruby_on_rails_chea...
helpful.

Pat
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-03-06 02:03
Pat Maddox wrote:
> Yeah, alias is a reserved word.
>
> You might find
> http://www.ilovejackdaniels.com/ruby_on_rails_chea...
> helpful.
>
> Pat

Thanks, Pat.
That's an awesome resource.


:-)
This topic is locked and can not be replied to.