<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ruby on Rails Archives - Cube Websites</title>
	<atom:link href="https://cubewebsites.com/category/development/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>https://cubewebsites.com/category/development/ruby-on-rails/</link>
	<description>web design and development</description>
	<lastBuildDate>Thu, 05 Jul 2012 20:59:14 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://cubewebsites.com/wp-content/uploads/2019/04/cropped-favicon-32x32.png</url>
	<title>Ruby on Rails Archives - Cube Websites</title>
	<link>https://cubewebsites.com/category/development/ruby-on-rails/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>FREEBIE: HotUKDeals (HUKD) Ruby Gem</title>
		<link>https://cubewebsites.com/development/ruby-on-rails/freebie-hotukdeals-hukd-ruby-gem/</link>
					<comments>https://cubewebsites.com/development/ruby-on-rails/freebie-hotukdeals-hukd-ruby-gem/#respond</comments>
		
		<dc:creator><![CDATA[Cube Websites]]></dc:creator>
		<pubDate>Thu, 05 Jul 2012 20:59:14 +0000</pubDate>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<guid isPermaLink="false">http://www.cubewebsites.com/blog/?p=412</guid>

					<description><![CDATA[<p>I&#8217;ve just finished work on a Ruby Gem which provides an interface for the HotUKDeals (HUKD) REST API. This gem provides all the following search methods: hottest deals newest deals discussed deals deals by username deals by tag name deals by merchant name online deals only offline deals only keyword search Each search method also [&#8230;]</p>
<p>The post <a href="https://cubewebsites.com/development/ruby-on-rails/freebie-hotukdeals-hukd-ruby-gem/">FREEBIE: HotUKDeals (HUKD) Ruby Gem</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve just finished work on a Ruby Gem which provides an interface for the HotUKDeals (HUKD) REST API.</p>
<p>This gem provides all the following search methods:</p>
<ul>
<li>hottest deals</li>
<li>newest deals</li>
<li>discussed deals</li>
<li>deals by username</li>
<li>deals by tag name</li>
<li>deals by merchant name</li>
<li>online deals only</li>
<li>offline deals only</li>
<li>keyword search</li>
</ul>
<div>Each search method also allows you to filter results by category, forum, limit the number of results.</div>
<div></div>
<div>It&#8217;s dead easy to install and run:</div>
<pre>    require 'hukd'
    hukd	=	Hukd.new("YOUR_API_KEY_HERE")
    deals	=	hukd.hottest('deals')
    deals.each |deal| do
    	puts(deal.title)
    end</pre>
<div>Full documentation can be found on the Github page.</div>
<p><a href="https://github.com/cubewebsites/hukd">Source code on Github<br />
</a><a href="https://rubygems.org/gems/hukd">Gem on rubygems.org</a><a href="https://github.com/cubewebsites/hukd"> </a></p>
<p>If you have any issues or requests then feel free to get in touch 🙂</p>
<p>The post <a href="https://cubewebsites.com/development/ruby-on-rails/freebie-hotukdeals-hukd-ruby-gem/">FREEBIE: HotUKDeals (HUKD) Ruby Gem</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cubewebsites.com/development/ruby-on-rails/freebie-hotukdeals-hukd-ruby-gem/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHP To Ruby On Rails: Making The Switch &#8211; Part I</title>
		<link>https://cubewebsites.com/technology/php-to-ruby-on-rails-making-the-switch-part-i/</link>
					<comments>https://cubewebsites.com/technology/php-to-ruby-on-rails-making-the-switch-part-i/#respond</comments>
		
		<dc:creator><![CDATA[Cube Websites]]></dc:creator>
		<pubDate>Tue, 17 Jan 2012 20:08:15 +0000</pubDate>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<guid isPermaLink="false">http://www.cubewebsites.com/blog/?p=389</guid>

					<description><![CDATA[<p>Introduction This year I’ve decided that I want to learn at least one new language and have decided that I’ll be learning Ruby.  I’ve read great things about Ruby and Rails, all about how it’s made development fun again for devs, lets you actually get on with creating responsive web applications and is generally just [&#8230;]</p>
<p>The post <a href="https://cubewebsites.com/technology/php-to-ruby-on-rails-making-the-switch-part-i/">PHP To Ruby On Rails: Making The Switch &#8211; Part I</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>This year I’ve decided that I want to learn at least one new language and have decided that I’ll be learning Ruby.  I’ve read great things about Ruby and Rails, all about how it’s made development fun again for devs, lets you actually get on with creating responsive web applications and is generally just so awesome.  I’ll be writing up everything I discover, whether it’s finding things which are much easier than their PHP alternative, or getting frustrated by the fact that I can’t figure out how to do something I’d normally consider trivial in PHP.</p>
<p>Part I is based on me setting up Rails on my local Windows machine and then spending a couple of hours working my way through the <a href="http://guides.rubyonrails.org/getting_started.html" target="_blank">Getting Started</a> tutorial.</p>
<p><strong>Ruby VS Ruby On Rails</strong></p>
<p>One of the first things I asked myself was, “am I learning Ruby or Ruby on Rails?” and went off in search for an answer, which was “both”.</p>
<p>Ruby is the language.  Rails is a framework written in Ruby which makes creating web applications really easy.<br />
So me learning Rails is actually me learning how create Rails applications in Ruby.  Got it?</p>
<p><strong>Setup</strong></p>
<p>The setup of Rails itself wasn’t too bad.  I just downloaded the Windows installer from <a href="http://rubyinstaller.org/" target="_blank">Ruby Installer</a> and the DevKit from the same site, which allows me to compile and use gems natively.  That was it for Rails installation, simple enough.</p>
<p><strong>MySQL Setup</strong></p>
<p>To create my first application I simply fired up Netbeans, which is my IDE of choice, and created a new Ruby on Rails Application.  This was pretty cool, except for the fact that I couldn’t get MySQL working.  I have MySQL running locally as part of WAMP, but installing the mysql gem for Ruby wasn’t enough.  Whenever I tried running the app it’d complain and quit.</p>
<p>I started looking up solutions, and spent a lot of time searching for people with similar issues, but no matter what I tried I couldn’t get it working.  I spent at least an hour looking for a fix and got really frustrated, it was quite a dark time, however I kept looking and finally found <a href="http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/" target="_blank">this solution</a> on how to install MySQL on Windows 7 64-bit with Ruby.  The tutorial was simple to follow, and as soon as I’d finished my app started working, good times.</p>
<p><strong>Hello Ruby</strong></p>
<p>Now that I had Rails setup and installed on my machine, it was time to start learning how to build things.  I went to the <a href="http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/" target="_blank">getting started tutorial</a> and worked my way through it.  As I worked through it I spotted a LOT of things which seemed to make me love Ruby, and lot of things which went well and truly over my head.</p>
<p><strong>Things I Loved</strong></p>
<ol>
<li><span style="color: #404040;"><strong>Sprockets</strong> – In your application directory, Rails has assets directories for JavaScript, Stylesheets and Images.  Whenever you use the CLI to create a new controller, it creates new .scss and .coffee files with the name of your controller.  This means that you can separate out all the style and scripts for each component of your site really easily.  Rails then compiles your <a href="http://sass-lang.com/" target="_blank">Sass</a> and <a href="http://coffeescript.org/" target="_blank">CoffeeScript</a> files when your run your application into a single CSS and a single JavaScript file.</span></li>
<li><span style="color: #404040;"><strong>Response types</strong> – it was so stupidly easy to return content in a specific format based on the URL extension.  For example:<br />
myurl.com/posts – would be the expected HTML output all my blog posts<br />
myurl.com/posts.json – would route to the same controller and action, but return all the blog posts as a JSON string<br />
myurl.com/posts.xml – all the posts but now as valid XML</span></li>
<li><span style="color: #404040;"><strong>Rails IS an MVC framework</strong> – Rails is built to be an MVC framework.  The moment you generate your first app (easy as: `rails new myappname`!) it creates a base application which follows the MVC pattern and easily allows you to extend it into your own.</span></li>
<li><span style="color: #404040;"><strong>Syntax that “just makes sense”</strong>– here’s a sample of a Model in Ruby:</span>
<pre>class Post &lt; ActiveRecord::Base
  validates :name,  :presence =&gt; true
  validates :title, :presence =&gt; true,
                    :length =&gt; { :minimum =&gt; 5 }

  has_many :comments
end</pre>
<div><span style="color: #404040;">It amazes at me at how much you can understand just from looking at the class declaration.</span></div>
</li>
<li><span style="color: #404040;"><strong>It’s So Simple</strong> – whilst you could argue that I now have the benefit of a few years PHP experience, I still remember that when I first started with PHP, which was my first web language (I&#8217;d done Java and C++ before), I spent a whole summer just going over the basics and working my way up to creating a blog as part of working through a book.  In fact, the blog was pretty poor an lacked a lot of key features like security and it was done in procedural programming.  It wasn’t until about a year into PHP that I started working with frameworks and OOP properly.  In comparison, it took me just a few hours to go from “I want to learn Ruby”, to having a working blog application using MVC conventions.</span></li>
</ol>
<p><strong>It’s Over My Head</strong></p>
<p>When I said there were a few things that went well over my head, well…I lied, it was basically just the syntax.  Whilst in some cases the syntax made a lot of sense, in other cases I was getting really confused e.g. when they were generating forms in the views and I had no idea what the hell was going on.  At the time I decided the best thing to do was to carry on the guide and then go through everything and look up the bits I didn&#8217;t get.<br />
This is actually as far as I’ve got to date, but see the next section on how I intend to learn the syntax.</p>
<p><strong>Where To Next?</strong></p>
<p>Whilst I’ve completed the basic blog tutorial, the next step is to learn how to make a full web application.  I’ve looked around and found that the book Agile Web Development With Rails is THE book to learn Rails with according to a lot of people.  I managed to find an early edition at work today and have brought it home to start looking through for the rest of this evening.<br />
The book has an appendix which contains a quick-start guide to the Ruby language and syntax so I’m going to start with that to understand the things from the blog tutorial which I didn’t quite get, and then make my way through the book which should also clarify some of the things for me.</p>
<p><strong>Verdict.</strong></p>
<p>Simply put, I think Rails is ACE.  So far it’s been great.  Whilst there’s some bits I don’t quite get yet, well what can you expect, it’s been about 3 hours so far!  Overall it seems to be a very powerful framework which not only enforces but also simplifies the best web programming conventions.  Lovin’ it.</p>
<p>The post <a href="https://cubewebsites.com/technology/php-to-ruby-on-rails-making-the-switch-part-i/">PHP To Ruby On Rails: Making The Switch &#8211; Part I</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cubewebsites.com/technology/php-to-ruby-on-rails-making-the-switch-part-i/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
