<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Ruby_-_form_save</id>
		<title>Ruby - form save - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Ruby_-_form_save"/>
		<link rel="alternate" type="text/html" href="https://logicwiki.co.uk/index.php?title=Ruby_-_form_save&amp;action=history"/>
		<updated>2026-05-07T20:38:18Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://logicwiki.co.uk/index.php?title=Ruby_-_form_save&amp;diff=699&amp;oldid=prev</id>
		<title>Dt1nh6: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://logicwiki.co.uk/index.php?title=Ruby_-_form_save&amp;diff=699&amp;oldid=prev"/>
				<updated>2016-05-09T13:27:51Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:27, 9 May 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Dt1nh6</name></author>	</entry>

	<entry>
		<id>https://logicwiki.co.uk/index.php?title=Ruby_-_form_save&amp;diff=698&amp;oldid=prev</id>
		<title>Macrop at 08:12, 30 November 2015</title>
		<link rel="alternate" type="text/html" href="https://logicwiki.co.uk/index.php?title=Ruby_-_form_save&amp;diff=698&amp;oldid=prev"/>
				<updated>2015-11-30T08:12:16Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:RubyOnRails]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:ror;&amp;quot;&amp;gt;&lt;br /&gt;
def create&lt;br /&gt;
  @article = Article.new(article_params)&lt;br /&gt;
  if @article.save&lt;br /&gt;
    flash[:notice] = &amp;quot;Article was successfully created&amp;quot;&lt;br /&gt;
    redirect_to article_path(@article)&lt;br /&gt;
  else&lt;br /&gt;
    render 'new'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Flash message code added to application.html.erb under app/views/layouts folder (right under &amp;lt;body&amp;gt; and above &amp;lt;%= yield %&amp;gt;:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:ror;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;% flash.each do |name, msg| %&amp;gt;&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;%= msg %&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code added to display errors in the new.html.erb template under app/views/articles folder:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:ror;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% if @article.errors.any? %&amp;gt;&lt;br /&gt;
  &amp;lt;h2&amp;gt;The following errors prevented the article from getting created&amp;lt;/h2&amp;gt;&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;% @article.errors.full_messages.each do |msg| %&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;%= msg %&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To create the show action, add the following show method to articles_controller.rb file:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:ror;&amp;quot;&amp;gt;&lt;br /&gt;
def show&lt;br /&gt;
  @article = Article.find(params[:id])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To create the show view, add a show.html.erb file under the app/views/articles folder and fill in the code:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:ror;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;Showing selected article&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Title: &amp;lt;%= @article.title %&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Description: &amp;lt;%= @article.description %&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Macrop</name></author>	</entry>

	</feed>