Search Results

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

Page 1/1 | 1 

  • undefined method `model_name' for NilClass:Class - Rails application

    - by user1270259
    So I have seen other articles here on stack about this and a lot of the time people are not doing @post = post.new. I read some where to use the plural...?? any ways I am getting this error on my discussion code: Discussion Controller class DiscussionsController < ApplicationController def index @discussion = Discussion.new @discussions = Discussion.all end def create @discussion = Discussion.create(params[:discussion]) if @discussion.save redirect_to tasks_path, :flash => {:success => 'Created a new discussion'} else redirect_to tasks_path, :flash => {:error => 'Failed to create a discussion'} end end end Discussion Form <%= form_for @discussion do |f| %> <p><%= f.label :title %> <%= f.text_field :title %></p> <p><%= f.label :content %> <%= f.text_area :content %></p> <% end %> Discussion Routes resources :discussions do resources :comments end Now as far as I know I am doing this right, because I have a task form set up essentially the same way - but I have looked at my code for hours and have googled and tried other examples and now i see this: undefined method `model_name' for NilClass:Class Extracted source (around line #1): 1: <%= form_for @discussion do |f| %> 2: 3: <p><%= f.label :title %> 4: <%= f.text_field :title %></p> Which should mean that I am missing something from my controller.....is it as asilly as a spelling mistake? .

    Read the article

1