This is my controller
class SchoolsController < ApplicationController
def teacher
@teacher = Teacher.new
end
def form_create
@teacher = Teacher.new(teacher_params)
if teacher.save
redirect_to schools_teacher_path
else
flash[:notice] = "error"
end
end
private
def teacher_params
params.require(:teacher).permit(:name)
end
end
This is my views/schools/teacher.html.erb
<%= form_for :teacher do |f| %>
<%= f.text_field :name %>
<%= f.submit %>
<% end %> I am new to ruby on rails, so plz help me to solve this problem.I hope u all. plz reply me
Aucun commentaire:
Enregistrer un commentaire