开发者

rails Formtastic routing issue

开发者 https://www.devze.com 2023-03-17 14:43 出处:网络
I am trying to setup a simple form using formtastic but running into a routing error when trying to save the form. I get the following error mes开发者_如何学Pythonsage. Let me know if you need any fur

I am trying to setup a simple form using formtastic but running into a routing error when trying to save the form. I get the following error mes开发者_如何学Pythonsage. Let me know if you need any further info. I am assuming this is a simple mistake on my part that I am overlooking.

Error

No route matches {:controller=>"projects"}

new

<%= semantic_form_for @project do |form| %>
  <%= form.inputs %>
  <%= form.buttons %>
<% end %>

Controller

def new
    @project = Project.new
end

def create
  @project = Project.new(params[:project])
  if @project.save
    flash[:success] = "Project Created!"
    redirect_to root_path
  else
    flash[:alert] = "Project failed"
    redirect :action => "new"
  end
end

Routes

resources :project

Model

class Project < ActiveRecord::Base
   ...
end


change this

resources :project

to

resources :projects
0

精彩评论

暂无评论...
验证码 换一张
取 消