<div class="col-xs-12">
	<h2>Edit article</h2>

	<%= form_for :article, url: article_path(@article), method: :put do |f| %>

		<% if @article && @article.errors.any? %>
			<p>
				<ul>
					<% @article.errors.full_messages.each do |msg| %>
						<li><%= msg %></li>
					<% end %>
				</ul>
			</p>
		<% end %>

		<p>
			<%= f.label :title %><br />
			<%= f.text_field :title %>
		</p>

		<p>
			<%= f.label :text %><br />
			<%= f.text_area :text %>
		</p>

		<p>
			<%= f.submit %>
		</p>

	<% end %>

	<%= form_for :article, url: article_path(@article), method: :delete, data: { confirm: 'Are you sure?' } do |f| %>

		<p>
			<%= f.submit 'Delete article' %>
		</p>

	<% end %>
</div>
<div class="col-xs-12">
	<% if @article.author_id == current_user.id %>
		
		<h2>Edit article</h2>

		<%= form_for :article, url: article_path(@article), method: :put do |f| %>

			<% if @article && @article.errors.any? %>
				<p>
					<ul>
						<% @article.errors.full_messages.each do |msg| %>
							<li><%= msg %></li>
						<% end %>
					</ul>
				</p>
			<% end %>

			<p>
				<%= f.label :title %><br />
				<%= f.text_field :title %>
			</p>

			<p>
				<%= f.label :text %><br />
				<%= f.text_area :text %>
			</p>

			<p>
				<%= f.submit %>
			</p>

		<% end %>

		<%= form_for :article, url: article_path(@article), method: :delete, data: { confirm: 'Are you sure?' } do |f| %>

			<p>
				<%= f.submit 'Delete article' %>
			</p>

		<% end %>
	
	<% else %>
	
		<h2>ACCESS DENIED</h2>
	
	<% end %>
</div>
Add verification of authorship before editing articles
Add verification of authorship before editing articles
