【问题标题】:Comfortable Mexican Sofa - Accessing cms content from the app舒适的墨西哥沙发 - 从应用程序访问 cms 内容
【发布时间】:2016-01-10 19:12:37
【问题描述】:

我无法从应用程序访问 cms 内容。

这是 rails 代码,我想从中访问 c​​ms 的内容。

# GET /songs
# GET /songs.json
def index
  @songs = Song.all
  render cms_page: 'songs/index', cms_site: (Rails.env.development? ? 'songs-en' : nil)
end

但我总是得到以下信息:

那里有我遗漏的东西吗?

【问题讨论】:

  • 图像中提取的源似乎与代码示例不匹配。我假设songs 和songs/index 的错误相同?你试过/songs/index(注意前导/)吗?
  • @CharlieEgan : 哦,该死,对不起...好像我上传了错误的图片...所以是的,如果我将代码更改为 /songs/index,然后我会得到 Cannot find CMS Page at /songs/index 我只是想知道我找不到“从应用程序访问 CMS 内容”的深入示例那种东西。
  • 天哪,看来我不仅必须将 / 放在 songs/index 的开头,而且还必须放另一个 / 在它的末尾。所以最终的形式(对我有用)看起来像 /songs/index/。谢谢大家。
  • 如果需要尾部斜杠,那么您可以考虑在github.com/comfy/comfortable-mexican-sofa/wiki/… 更新文档或提交问题以就此事展开讨论。很高兴你把它整理好了。

标签: ruby-on-rails ruby ruby-on-rails-4 comfortable-mexican-sofa


【解决方案1】:

天哪,看来我不仅必须在 songs/index 的开头加上 /,而且还得再放一个 /强> 在它的最后。所以最终的形式(对我有用)看起来像 /songs/index/。

谢谢大家。非常感谢@CharlieEgan

亨德利一世。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多