There are a few activerecord settings (table_name, table_name_prefix maybe some others) that could do this. Might these be getting changed by accident (perhaps because your model has a method whose name clashes with an active record method) ?
Fred
=> "my_items">> a = MyItem.table_name
>> b = a
=> "my_items"
>> c = b
=> "my_items"
>> d = c
=> "my_items"
>> d << ", other_items"
=> "my_items, other_items" <---- Same result! Looks right.
>> c
=> "my_items, other_items"
>> MyTable.table_name
=> "my_items, other_items" <--- Oh noes, the result was inherited all the way down to the table_name of the model!
Now the MyItem model is borked until the app is restarted.
The malformed 'from' clause was a bit of a red herring and that was easily resolved, btw. (A 'join(', ')' was skipped because the construction of the from-clause was a string not an array any more in our code.)
The '<<' method appears to work the same as the String method ".concat(something)" . It also makes all other variables inherit the same value.
Another possible solution is to use '.dup', for what it is worth:
>> d = c.dup
=> "my_items"
>> d << ", other_items"
=> "my_items, other_items"
>> c
=> "my_items"
I hope this helps somebody if they run into a similar problem! (I don't claim this is a Ruby bug or such, just perhaps not very well documented feature.)
Phil