You can see here that it seems like the raw contents of my DB are being printed to the page. I can't see anywhere in my code why there would be the raw output of the db printed to the view. Here is the code for the index view:
<div class="main">
<div="messages">
<%=@messages.each do |t|%>
<h2 class="subject"><%=t.subject%></h2>
<p class="content"><%=t.content%></p>
<% end %>
<%=link_to "Create Message", edit_path%>
</div>
</div>
The Create Form/View:
<div class="formWrapper">
<%= form_for @messages do |t|%>
<div class ="Inputs">
<%=t.text_field :subject%><br>
<%=t.text_area :content%>
<div class="submit">
<%=t.submit "Submit"%>
</div>
<%end%>
</div>
</div>
The Controller:
class MessagesController < ApplicationController
def index
@messages=Message.all
end
def new
@messages=Message.new
end
def create
@messages = Message.new(message_params)
if @messages.save
redirect_to '/'
else
render 'new'
end
end
private
def message_params
params.require(:message).permit(:content, :subject)
end
end