【问题标题】:Find Children of Specific Page with RefineryCMS and ActiveRecord使用 RefineryCMS 和 ActiveRecord 查找特定页面的子页面
【发布时间】:2014-07-25 18:09:55
【问题描述】:

现在我有一个带有自定义模板的页面。

我想在页面装饰器中像这样在过滤器之前使用装饰器:

before_filter :get_gallery_index, :only => [:gallery_main]

要定义这个方法,我想声明类似的东西:

  def get_gallery_index
    # a = Refinery::Page.where(id: 6).children <- would be ideal
  end

当然,children 不是 Refinery Pages 和 ActiveRecord 的有效方法。有没有人建议我如何获得这些记录?

【问题讨论】:

    标签: ruby-on-rails ruby activerecord refinerycms


    【解决方案1】:

    通过 parent_id 搜索得到它:

    def get_gallery_index @gallery_index = 炼油厂::Page.where(:parent_id => 6) 结束

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-06
      • 2019-07-11
      • 2014-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多