Search Results

Search found 1 results on 1 pages for 'user1850886'.

Page 1/1 | 1 

  • NoMethodError / undefined method `foobar_path' when using form_for

    - by user1850886
    I'm using form_for to create a chatroom and when I view the page I get the following error: NoMethodError in Chatrooms#new undefined method `chatrooms_path' for #<#<Class:0xa862b94>:0xa5307f0> Here's the code for the view, located in app/views/chatrooms/new.html.erb: <div class="center"> <%= form_for(@chatroom) do |f| %> <%=f.text_field :topic%> <br> <%=f.submit "Start a discussion", class: "btn btn-large btn-primary"%> <% end %> </div> Here's the relevant controller: class ChatroomsController < ApplicationController def new @chatroom = Chatroom.new end def show @chatroom = Chatroom.find(params[:id]) end end If I change the line <%= form_for(@chatroom) do |f| %> to <%= form_for(:chatroom) do |f| %> it works fine. I've searched around for similar questions but none of the solutions have worked for me. Help?

    Read the article

1