2013-02-16 81 views
1

我有2個屬性的模型。如何從URL中提取域名before_create?

attr_accessible :app_url, :entity_name 

而且我傳遞:APP_URL對象價值就像從查看這個 「www.aaronsw.com/feeds/pgessays.rss」。

在Model中使用before_create方法。 ENTITY_NAME的應該是這樣的「www.aaronsw.com」(必須從APP_URL屬性提取域名)

解答請

回答