Rails 4 Dynamic Subdomains

走远了吗. 提交于 2019-12-06 06:13:05

The find_by_* method is on the class itself:

City.find_by_subdomain!(request.subdomain)

What is City.friendly returning? Whatever it is, I doubt it's the City class.

Also, you can use find_by with a hash now:

City.find_by subdomain: request.subdomain

http://guides.rubyonrails.org/active_record_querying.html#retrieving-a-single-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!