【发布时间】:2014-06-28 14:41:06
【问题描述】:
我有一个 Application.rb
belongs_to :company
而Company.rb可以
has_many :applications
我在 Company 模型上设置了friendly_id,但也希望在我的应用程序上使用它。但是应用程序不会将我想要的内容存储为 slug_candidates。我希望从应用程序所属的公司中提取 slug 候选人。
这是我的Applicatio.rb
extend FriendlyId
friendly_id :slug_candidates, use: [:slugged, :history]
def slug_candidates
[
:intern_type,
[:intern_type, Company.city]
]
end
我将如何设置它以便它应该从公司获取它?
【问题讨论】:
标签: ruby-on-rails ruby friendly-id