ActiveModel::ForbiddenAttributesError
1 2Extracted source (around line #7): 35 46 57 68 79 810 9 10 11 def create 12 @post= Post.new(params[:post]) 13 @post.save 14 redirect_to @post 15 end 16 17Rails.root: /Users/taotao/Desktop/ruby_lesson/blog
上記のエラーが発生します。
下記がpostコントローラー内容とmodelです。
class PostsController < ApplicationController def new end def create @post= Post.new(params[:post]) @post.save redirect_to @post end def show @post =Post.find(params[:id]) end private def post_params params.require(:post).permit(:title, :text) end def index @post=Post.all end end
model class Post < ActiveRecord::Base end
http://ruby-rails.hatenadiary.com/entry/20140813/1407915718#getting-up-and-running
↑サイトの4.7で詰まってしまいました。ご検討頂けたら幸いです。よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。