ruby - rails : Routing Error - No route matches [GET] "/posts/new" -
i'm creating simple crud , trouble create method.
error
no route matches [post] "/usuarios/new"
this controller:
controller
class articlescontroller < applicationcontroller def index @articles = article.all end def show @article = article.find(params[:id]) end def new @article = article.new end def create @article = article.new(article_params) if @article.save redirect_to @article else render 'new' end end private def article_params params.require(:article).permit(:title, :text) end
my new.html.reb file :
new.html.erb
<%= form_for :article |f| %> <p> <%= f.label :title %><br> <%= f.text_field :title %> </p> <p> <%= f.label :text %><br> <%= f.text_area :text %> </p> <p> <%= f.submit %> </p> <% end %>
my routes.rb file :
routes.rb
rails.application.routes.draw 'welcome/index' resources :articles root 'welcome#index' end
anybody can me?
most part of post redundant in context. seems try call new_usarios_path
, in case must define route in routes.rb
file:
resources :usarios
Comments
Post a Comment