Please help me solve the problem.
There is a controller:
class NewsController < ApplicationController def index # @news = News.all.order(created_at: :desc) @news = News.page(params[:page]) end def show end end I'm trying to generate a link like:
<%= link_to 'More', controller: "news", action: "show", id: news_item.id %> but multiline. To do this, create the following template:
<% @news .each do |news_item| %> <%= link_to(news_path, { controller: "news", action: "show", id: news_item.id }) do %> <span>qwerty</span> <% end %> <% end %> As a result, I get the following error message:
NameError in News#index Showing /home/kalinin/rails/visit/app/views/news/index.html.erb where line #4 raised: undefined local variable or method `news_path' for #<#<Class:0x007f221c8a0738>:0x007f221c391dc8>