开发者

rails Formtastic routing issue

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜