Rubyで非常に新しく、ラジオボタンの選択を私のビューに表示させることができませんでした。回答がログに表示されているのを見ることができますが、ビューに表示させることができませんでした。ruby on railsで表示するラジオボタンの回答を取得する方法
マイ_form.html.erb:
<%= f.label :_ %>
<%= radio_button_tag(:comein, "Drop Off") %>
<%= label_tag(:comein, "Drop Off") %>
<%= radio_button_tag(:comein, "Pick Up") %>
<%= label_tag(:comein, "Pick Up") %>
マイshow.html.erbビュー:
<strong>How Order Is Coming Into Office:</strong>
<%= @article.comein %>
マイコントローラ:
class ArticlesController < ApplicationController
def index
@articles = Article.all
end
def show
@article = Article.find(params[:id])
end
def new
@article = Article.new
end
# snippet for brevity
def edit
@article = Article.find(params[:id])
end
def create
@article = Article.new(article_params)
if @article.save
redirect_to @article
else
render 'new'
end
end
def update
@article = Article.find(params[:id])
if @article.update(article_params)
redirect_to @article
else
render 'edit'
end
end
def destroy
@article = Article.find(params[:id])
@article.destroy
redirect_to articles_path
end
private
def article_params
params.require(:article).permit(:number, :address, :forename, :surname, :ordertype, :notes, :comein, :goout)
end
end
ありがとう!今素晴らしいです – Mike
@マイク嬉しいものがあなたのために働いた。そうであれば、回答の左上にあるチェックマークをクリックして、他の人にあなたのために働いたことを知らせてください。この回答は、他の人にとってもあなたにとって有益だったと証明されるかもしれません。 – MarsAtomic