RefineryCMS:投资组合库插件引入的路由错误
RefineryCMS: routing error introduced by portfolio gallery plugin
我正在使用 RefineryCMS as a rails CMS, it was working like a charm until I followed the answer in this question to get a simple image gallery functionality going. Now I'm getting the same error as shown on this 问题。我没有更改任何 rails 代码来引入带有 nil 引用的 link_to 标记,但是(指南中有 link_to image_tag 行,但我'已经注释掉了,没有任何改变),所以我相信它发生在自动生成的代码中。这是我在我的网站上登录 refinery 时遇到的完整错误:
ActionController::UrlGenerationError in Refinery::Authentication::Devise::Admin::Users#index
Showing /home/mpvoss/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/core/app/views/refinery/admin/_menu_item.html.erb where line #1 raised:
No route matches {:action=>"index", :controller=>"refinery/refinery/portfolio/admin/galleries", :locale=>:en}
Extracted source (around line #46):
44 message << " missing required keys: #{missing_keys.sort.inspect}" unless missing_keys.empty?
45
46 raise ActionController::UrlGenerationError, message
47 end
48
49 def clear
Trace of template inclusion: /home/mpvoss/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/core/app/views/refinery/admin/_menu.html.erb, /home/mpvoss/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/core/app/views/layouts/refinery/admin.html.erb
注意:无需登录 refinery 即可加载网站,因为它不会尝试加载下面遇到路由问题的菜单代码。
好,我们来看看_menu.html.erb
<%= link_to menu_item.title, refinery.url_for(menu_item.url),
:class => ("active" if menu_item.highlighted?(params)),
:id => "plugin_#{menu_item.name}" %>
这段代码只是为所有插件制作了一个菜单栏。它可以被注释掉并且精炼厂工作(上面的错误消失),但我需要那个菜单栏来更改网站。
我试过了。
在~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-portfolio-289b85b18771/app/controllers/refinery/portfolio/admin里找到了一个galleries_controller.rb,好像是controller错误正在谈论。它没有索引操作,所以我添加了一个空操作以查看是否是问题所在并且没有任何改变。 ~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-portfolio-289b85b18771/ gem 的 routes.rb 低于
在我的 Gemfile 和 运行 捆绑安装中注释掉投资组合 gem 但我得到了同样的错误,因为自动生成的代码(指的是像 .[=53= .2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/) 仍在执行(我使用 git 进行版本控制,并在这些更改之前对项目进行干净的克隆,它具有相同的问题,因为自动生成的代码不是版本控制的一部分)。
- gem 卸载 refinery-photo-gallery、refinerycms-page-images 和 refinerycms-portfolio gems 我认为可能是导致问题的原因
- 我将 ~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/ 中的所有 gem 移出了该目录,以查看是否有一个包安装会重新生成新鲜、干净的 gems 但没有任何改变。
None 这些想法产生了影响。如果需要任何说明,请告诉我。一个星期以来,我一直为此感到困惑,我的谷歌搜索技能让我失望了。非常感谢任何帮助!
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-portfolio-289b85b18771/routes.rb
Refinery::Core::Engine.routes.draw do
# Frontend routes
namespace :portfolio, :path => Refinery::Portfolio.page_url do
root :to => "galleries#index"
resources :galleries, :only => [:index, :show]
end
# Admin routes
namespace :portfolio, :path => '' do
namespace :admin, :path => Refinery::Core.backend_route do
scope :path => 'portfolio' do
resources :galleries, :except => :show do
get :children, :on => :member
post :update_positions, :on => :collection
resources :items, :except => [:show] do
post :update_positions, :on => :collection
end
end
resources :items do
post :update_positions, :on => :collection
end
end
end
end
end
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
# Use SCSS for stylesheets
# Use Uglifier as compressor for JavaScript assets
# Use CoffeeScript for .coffee assets and views
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
# Added by Matthew, Thin server
gem 'faye'
gem 'thin'
group :assets do
#gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 4.1.0'
gem 'sass-rails', '~> 5.0'
#gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass','~> 3.1.1'
gem 'uglifier', '>= 1.3.0'
#gem 'uglifier', '>= 1.0.3'
end
gem 'twitter-bootstrap-rails'
gem 'refinerycms', git: 'https://github.com/refinery/refinerycms', branch: 'master'
#gem 'refinerycms-page-images', '~> 2.0.0'
gem 'quiet_assets', group: :development
#gem 'refinerycms-photo-gallery', '~> 0.1.0'
# Add support for searching inside Refinery's admin interface.
gem 'refinerycms-acts-as-indexed', ['~> 2.0', '>= 2.0.0']
# Add support for Refinery's custom fork of the visual editor WYMeditor.
gem 'refinerycms-wymeditor', ['~> 1.0', '>= 1.0.6']
gem 'refinerycms-portfolio', github: 'refinery/refinerycms-portfolio', branch: 'master'
# The default authentication adapter
gem 'refinerycms-authentication-devise', '~> 1.0'
看起来这是 portfolio/images 插件中的错误,尝试了另一个包更新,更新后的代码非常有效。 <3 RefineryCMS 贡献者
我正在使用 RefineryCMS as a rails CMS, it was working like a charm until I followed the answer in this question to get a simple image gallery functionality going. Now I'm getting the same error as shown on this 问题。我没有更改任何 rails 代码来引入带有 nil 引用的 link_to 标记,但是(指南中有 link_to image_tag 行,但我'已经注释掉了,没有任何改变),所以我相信它发生在自动生成的代码中。这是我在我的网站上登录 refinery 时遇到的完整错误:
ActionController::UrlGenerationError in Refinery::Authentication::Devise::Admin::Users#index
Showing /home/mpvoss/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/core/app/views/refinery/admin/_menu_item.html.erb where line #1 raised:
No route matches {:action=>"index", :controller=>"refinery/refinery/portfolio/admin/galleries", :locale=>:en}
Extracted source (around line #46):
44 message << " missing required keys: #{missing_keys.sort.inspect}" unless missing_keys.empty?
45
46 raise ActionController::UrlGenerationError, message
47 end
48
49 def clear
Trace of template inclusion: /home/mpvoss/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/core/app/views/refinery/admin/_menu.html.erb, /home/mpvoss/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/core/app/views/layouts/refinery/admin.html.erb
注意:无需登录 refinery 即可加载网站,因为它不会尝试加载下面遇到路由问题的菜单代码。
好,我们来看看_menu.html.erb
<%= link_to menu_item.title, refinery.url_for(menu_item.url),
:class => ("active" if menu_item.highlighted?(params)),
:id => "plugin_#{menu_item.name}" %>
这段代码只是为所有插件制作了一个菜单栏。它可以被注释掉并且精炼厂工作(上面的错误消失),但我需要那个菜单栏来更改网站。
我试过了。
在~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-portfolio-289b85b18771/app/controllers/refinery/portfolio/admin里找到了一个galleries_controller.rb,好像是controller错误正在谈论。它没有索引操作,所以我添加了一个空操作以查看是否是问题所在并且没有任何改变。 ~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-portfolio-289b85b18771/ gem 的 routes.rb 低于
在我的 Gemfile 和 运行 捆绑安装中注释掉投资组合 gem 但我得到了同样的错误,因为自动生成的代码(指的是像 .[=53= .2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-0a37f8090278/) 仍在执行(我使用 git 进行版本控制,并在这些更改之前对项目进行干净的克隆,它具有相同的问题,因为自动生成的代码不是版本控制的一部分)。
- gem 卸载 refinery-photo-gallery、refinerycms-page-images 和 refinerycms-portfolio gems 我认为可能是导致问题的原因
- 我将 ~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/ 中的所有 gem 移出了该目录,以查看是否有一个包安装会重新生成新鲜、干净的 gems 但没有任何改变。
None 这些想法产生了影响。如果需要任何说明,请告诉我。一个星期以来,我一直为此感到困惑,我的谷歌搜索技能让我失望了。非常感谢任何帮助!
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/refinerycms-portfolio-289b85b18771/routes.rb
Refinery::Core::Engine.routes.draw do
# Frontend routes
namespace :portfolio, :path => Refinery::Portfolio.page_url do
root :to => "galleries#index"
resources :galleries, :only => [:index, :show]
end
# Admin routes
namespace :portfolio, :path => '' do
namespace :admin, :path => Refinery::Core.backend_route do
scope :path => 'portfolio' do
resources :galleries, :except => :show do
get :children, :on => :member
post :update_positions, :on => :collection
resources :items, :except => [:show] do
post :update_positions, :on => :collection
end
end
resources :items do
post :update_positions, :on => :collection
end
end
end
end
end
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
# Use SCSS for stylesheets
# Use Uglifier as compressor for JavaScript assets
# Use CoffeeScript for .coffee assets and views
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
# Added by Matthew, Thin server
gem 'faye'
gem 'thin'
group :assets do
#gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 4.1.0'
gem 'sass-rails', '~> 5.0'
#gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass','~> 3.1.1'
gem 'uglifier', '>= 1.3.0'
#gem 'uglifier', '>= 1.0.3'
end
gem 'twitter-bootstrap-rails'
gem 'refinerycms', git: 'https://github.com/refinery/refinerycms', branch: 'master'
#gem 'refinerycms-page-images', '~> 2.0.0'
gem 'quiet_assets', group: :development
#gem 'refinerycms-photo-gallery', '~> 0.1.0'
# Add support for searching inside Refinery's admin interface.
gem 'refinerycms-acts-as-indexed', ['~> 2.0', '>= 2.0.0']
# Add support for Refinery's custom fork of the visual editor WYMeditor.
gem 'refinerycms-wymeditor', ['~> 1.0', '>= 1.0.6']
gem 'refinerycms-portfolio', github: 'refinery/refinerycms-portfolio', branch: 'master'
# The default authentication adapter
gem 'refinerycms-authentication-devise', '~> 1.0'
看起来这是 portfolio/images 插件中的错误,尝试了另一个包更新,更新后的代码非常有效。 <3 RefineryCMS 贡献者