sql - How to set database table name in Rails 4 with dot in name -
sql - How to set database table name in Rails 4 with dot in name -
i have table dot in name , cannot create query it. table name is: site.com_news
in model, according how explicitly specify model's table-name mapping in rails? set:
class news < activerecord::base self.table_name = "site.com_news" end
in log:
e, [2014-10-06t17:22:34.119037 #15975] error -- : mysql2::error: table 'site.com_news' doesn't exist: select `site`.`com_news`.* `site`.`com_news` i, [2014-10-06t17:22:34.150211 #15975] info -- : rendered news/index.html.erb within layouts/application (36.2ms) i, [2014-10-06t17:22:34.150696 #15975] info -- : completed 500 internal server error in 65ms f, [2014-10-06t17:22:34.155848 #15975] fatal -- : actionview::template::error (mysql2::error: table 'site.com_news' doesn't exist: select `site`.`com_news`.* `site`.`com_news`):
how escape dot character in table name? seek "site.com_news
" - not work.
according http://dev.mysql.com/doc/refman/5.0/en/identifiers.html: database , table names cannot contain “/”, “\”, “.”, or characters not permitted in file names.
thank in php construction work :(
sql ruby-on-rails ruby-on-rails-4 model
Comments
Post a Comment