在redirect_to @article的NoMethodError(未定义的方法' article_URL'),

时间:2017-04-16 22:50:51

标签: ruby-on-rails

我在<div class="wrapper"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/S%C3%A4ugende_H%C3%BCndin.JPG/800px-S%C3%A4ugende_H%C3%BCndin.JPG" class="picture"> </div> .wrapper { position: relative; left: 40%; width: 100px; height: 200px; border: 1px black solid; overflow: hidden; text-align: center; } .picture { position: relative; min-height: 100%; min-width: 100%; height: auto; width: auto; margin: auto; left: 0; right: 0; background-position: center; } 中收到了上述错误,以下是代码:

ArticlesController

1 个答案:

答案 0 :(得分:1)

使用resources代替resource

Rails.application.routes.draw do
  resources :articles
  root 'welcome#index'
end

复数,而不是单数。