hi all iam actually new to rails dev and iam trying to learn rails on my own , i was trying a simple input app.
*index.html *
Enter the Text below
- <%= form_with model: @contact do |form| %>*
- <%= form.text_field :title %>*
- <%= form.submit “Create” %>*
- <% end %>*
controller.rb:
class ContactController < ApplicationController
-
def index*
-
end*
-
def new*
-
@contact =Contact.new*
-
end*
-
def create*
-
@contact =Contact.new(params[:contact])*
-
if @contact.save*
-
redirect_to @contact*
-
else*
-
render 'new'*
-
end*
-
@contact = Contact.new(params[:contact])*
-
-
# @contact.save*
-
redirect_to @contact*
-
end*
-
def show*
-
@contact = Contact.find(params[:id])*
-
end*
-
private*
-
def contact_params*
-
params.require(:contact).permit(:text)*
-
end*
-
-
def new*
-
end*
end
i want to print / display the input in the show method can someone help me with this