ruby on rails - NoMethodError in Articles#new undefined method `model_name' for #<Article:0x000000035a3450> -
i having problem while creating articles ui.
my task make new page "create article" shown on page , text fields title , description , submit button when press submit button article typed in should saved , when go page articles saved should there.
error log:
this cloud 9 code
routes.rb
:
rails.application.routes.draw # priority based upon order of creation: first created -> highest priority. # see how routes lay out "rake routes". # can have root of site routed "root" # root 'welcome#index' resources :articles root 'pages#home' 'about', to: 'pages#about'
articles controller (articles_controller.rb
):
class articlescontroller < applicationcontroller def new @article = article.new end end
new.html.erb
in articles folder in views:
<h1>create article</h1> <%= form_for @article |f| %> <% end %>
article model (article.rb
) :
class article end
is article
model subclass of activerecord::base
(applicationrecord
rails 5.x)?
class article < activerecord::base end
Comments
Post a Comment