Reputation: 1234
I've been having trouble getting past this error. It says that it 'text' is undefined.
class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
def create
@post = Post.new(post_params)
respond_to do |format|
if @post.save # (this line is highlighted in the error)
format.html { redirect_to @post, notice: 'Post was successfully created.' }
format.json { render action: 'show', status: :created, location: @post }
else
format.html { render action: 'new' }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end
This worked fine when I had originally 'rails generate' the scaffold with title:string body:text.
I've been stuck on this problem all day. Suggestions would be awesome.
Upvotes: 0
Views: 844