I'm very new to ruby on rails and haven't been able to get my radio button selections to display in my view. I can see the answers are appearing in the log but I haven't been able to get them to display in the views.
My _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") %>
My show.html.erb view:
<strong>How Order Is Coming Into Office:</strong>
<%= @article.comein %>
My controller:
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
Aucun commentaire:
Enregistrer un commentaire