I've found out something very interesting. If I'm first connected to
Postgresql, then switch to Mysql, I can reset both table and column names
properly using

Model.reset_column_information

and

Model.reset_table_name

This gives me the proper backquoted columns/table names for Mysql.

User.scoped.to_sql #=> "SELECT `users`.* FROM `users`"

If however, I switch back to Postgresql, and run the same commands, it
doesn't actually reset the column information properly, only the table_name.

User.scoped.to_sql #=> "SELECT \"users\".* FROM `users`"

I've found that it actually doesn't matter in which order this happens. The
first switch to one adapter allows me to reset properly. The second switch
however does NOT.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TI3RzzCOCqQJ.
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.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 24, '11 at 3:24p
activeSep 24, '11 at 3:24p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Bradley: 1 post

People

Translate

site design / logo © 2021 Grokbase