0
아래의 양식을 제출하면 "게시 됨"check_box 값이 게시되지 않습니다.check_box 값이 db에 게시되지 않는 이유
params3 = { "UTF8"=> "✓" "authenticity_token"=> "i4SbblLJKIwba9yD30sDQCsir28/xdUxQZ90qYTNn0A =" "이야기"=> { "이름"=> "asdsaddsad", "포스트" => "asdasdasdasd", "user_id"=> "13", "image_id"=> "1", "published"=> "1"} "commit"=> "Save Story", "action"= > "제어기"=> "층"}
def create
@story = Story.new(story_params)
respond_to do |format|
if @story.save
format.html { redirect_to @story, notice: 'Story was successfully created.' }
format.json { render action: 'show', status: :created, location: @story }
else
format.html { render action: 'new' }
format.json { render json: @story.errors, status: :unprocessable_entity }
end
end
end
<%= form_for @story do |f| %>
<%= f.text_field :name, placeholder: "Enter Title" %>
<%= f.text_area :post, placeholder: "Enter Story" %>
<br/>
<%= f.hidden_field :user_id, value: current_user.id %>
<%= f.hidden_field :image_id, value: @image.id %>
<%= f.label "Publish this" %>
<%= f.check_box :published %>
<%= f.submit "Save Story" %>
<% end %>
양식을 게시하고 '게시'데이터 유형을 알려주십시오. –
죄송합니다. 중괄호로 감싸는 것을 잊지 마세요. – isea