<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Ruby on Rails, London - The Blog by Dynamic50</title>
	
	<link>http://blog.dynamic50.com</link>
	<description>Ruby on Rails, London - The Blog by Dynamic50</description>
	<lastBuildDate>Fri, 10 Aug 2012 14:57:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/dynamic50" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dynamic50" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/dynamic50" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Fdynamic50" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Automatic Sitemap for Heroku with Ruby on Rails 3.2</title>
		<link>http://blog.dynamic50.com/2012/08/10/automatic-sitemap-for-heroku-with-ruby-on-rails-3-2/</link>
		<comments>http://blog.dynamic50.com/2012/08/10/automatic-sitemap-for-heroku-with-ruby-on-rails-3-2/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 12:09:44 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[sitemap]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1170</guid>
		<description><![CDATA[A while back I wrote a blogpost on generating a sitemap for a ruby on rails app. This generator was run via a rake task. Now that loads of our apps are deployed to heroku and some have content that changes all of the time, it doesn&#8217;t make sense to have a rake task to [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I <a href="http://blog.dynamic50.com/2010/09/09/creating-a-sitemap-for-rails-and-heroku/">wrote a blogpost</a> on generating a sitemap for a ruby on rails app. This generator was run via a rake task. Now that loads of our apps are deployed to heroku and some have content that changes all of the time, it doesn&#8217;t make sense to have a rake task to run periodically for us, we need a sitemap on the fly. So here is how we did it:</p>

<p>Step 1:<br />
In your config/routes.rb file add:</p>


<pre>match 'sitemap', :to =&gt; &quot;sitemap#index&quot;, :as =&gt; :sitemap</pre>



<p>Step 2:<br />
Create a controller called &#8220;app/views/sitemap_controller.rb&#8221;<br />
Paste the following into it:</p>


<pre>
class SitemapController &lt; ApplicationController
  def index
    static_urls = [ {:url =&gt; '/home/about',      :updated_at =&gt; &quot;&quot;},
                    {:url =&gt; '/home/help',       :updated_at =&gt; &quot;&quot;},
                    {:url =&gt; '/home/contact_us', :updated_at =&gt; &quot;&quot;},
                    {:url =&gt; '/home/terms',      :updated_at =&gt; &quot;&quot;} ] 
    @pages_to_visit  = static_urls
    @pages_to_visit += Article.all.collect{  |a| {:url =&gt; article_path(a) ,  :updated_at =&gt; I18n.l(a.updated_at, :format =&gt; :w3c)} }
    @pages_to_visit += Category.all.collect{ |c| {:url =&gt; category_path(c) , :updated_at =&gt; I18n.l(c.updated_at, :format =&gt; :w3c)} }
    respond_to do |format|
      format.xml
    end
  end
end
</pre>



<p>Step 3:<br />
Create a view for the xml. I have used Haml for my view, you could use builder as an alternative. Call this &#8220;app/views/sitemap/index.xml.haml&#8221;</p>



<pre>
- base_url = &quot;http://#{request.host_with_port}&quot;
!!! XML
%urlset{:xmlns =&gt; &quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;}
  - @pages_to_visit.each do |page|
    %url
      %loc #{base_url}#{page[:url]}
      - if page[:updated_at].present?
        %lastmod= page[:updated_at]
      %changefreq= page[:changefreq].present? ? page[:changefreq] : &quot;monthly&quot;
      %priority= page[:priority].present? ? page[:priority] : &quot;0.5&quot;
</pre>



<p>Step 4: <br />
Sitemaps require the date to be in the w3c DateTime format. This involves creating a specific Time format. In &#8220;config/locales/en.yml&#8221; add the following format:</p>


<pre>
en:
  time:
    formats:
      w3c: &quot;%Y-%m-%dT%H:%M:%S+00:00&quot;
</pre>


<p>Note: The timezone is has been hard-coded here. In ruby 1.9.3 you can specify &#8220;%:z&#8221; to get the timezone at the end of this, however heroku is running 1.9.1 so this cannot be done. However Heroku is at <span class="caps">UTC </span>time anyway so this does not matter!</p>

<p>If you don&#8217;t have anything custom inside this file that should be the entire contents of the file. <br />
This means you can now use &#8220;I18n.l&#8221; to specify your custom timestamp format, for example:</p>


<pre>
I18n.l(a.updated_at, :format =&gt; :w3c)
</pre>


<p>which we used above.</p>

<p>And thats your sitemap on the fly! You could also generate a html sitemap if you wanted alongside this, or any other format you wish. <br />
For the html one just add a format.html in the respond_to block of the controller and then add a new file in &#8220;app/views/sitemap/index.html.haml&#8221; and put your haml view for the html sitemap there. If you are not using haml substitute &#8220;.haml&#8221; for &#8220;.erb&#8221;</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=-D09Slu-wuI:GOJsxMJCAG0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2012/08/10/automatic-sitemap-for-heroku-with-ruby-on-rails-3-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Training Courses</title>
		<link>http://blog.dynamic50.com/2012/08/09/ruby-on-rails-training-days/</link>
		<comments>http://blog.dynamic50.com/2012/08/09/ruby-on-rails-training-days/#comments</comments>
		<pubDate>Thu, 09 Aug 2012 16:30:14 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[London]]></category>
		<category><![CDATA[ror]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1158</guid>
		<description><![CDATA[Dynamic50 have recently run three very successful Ruby on Rails training courses. One over a weekend, one 3 day during the week and another in-house course for a company looking to transition to rails. The courses are tailored to the ability of the group and we have run several different versions now, from basic programming [...]]]></description>
			<content:encoded><![CDATA[<p>Dynamic50 have recently run three very successful Ruby on Rails training courses. One over a weekend, one 3 day during the week and another in-house course for a company looking to transition to rails.</p>

<p>The courses are tailored to the ability of the group and we have run several different versions now, from basic programming skills all the way through to expert in different technologies or basic experience with rails.</p>

<p>All courses went really well and the feedback has been very positive:</p>

<blockquote>&#8220;Excellent value for money, and I&#8217;m now coding RoR on a project!&#8221; &#8211; Dan Murphy</blockquote>

<p>If you are interested in Dynamic50 running a course for your company, or would like to be included on the mailing list for our future courses please <a href="http://dynamic50.com/contacts/new">get in touch!</a>, we&#8217;d love to hear from you.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=h2dE2UDaSfs:yuTVgleUjnQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2012/08/09/ruby-on-rails-training-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongoid Embedded Documents embeds_many form example using simple_form</title>
		<link>http://blog.dynamic50.com/2012/01/16/mongoid-embedded-documents-embeds_many-form-example-using-simple_form/</link>
		<comments>http://blog.dynamic50.com/2012/01/16/mongoid-embedded-documents-embeds_many-form-example-using-simple_form/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 16:17:12 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[mongoid]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1162</guid>
		<description><![CDATA[Below is an example of how to produce a form for an embeds_many association for mongoid and simple_form (although this will also work with the standard rails helpers). Class User include Mongoid::Document embeds_many :children, :class_name =&#38;gt; &#34;Child&#34; accepts_nested_attributes_for :children, reject_if: proc { &#124;attributes&#124; attributes[&#34;age&#34;].blank? } end Class Children include Mongoid::Document field :age, type: String embedded_in [...]]]></description>
			<content:encoded><![CDATA[<p>Below is an example of how to produce a form for an embeds_many association for mongoid and simple_form (although this will also work with the standard rails helpers).</p>


<pre>Class User
  include Mongoid::Document
  embeds_many :children, :class_name =&amp;gt; &quot;Child&quot;
  accepts_nested_attributes_for  :children, reject_if: proc { |attributes| attributes[&quot;age&quot;].blank? }
end

Class Children
  include Mongoid::Document
  field :age, type: String
  embedded_in :user
  validates_presence_of :age
end</pre>


<p>And on the view side then we can simply use simple_fields_for now as it is a now a nested attribute:</p>


<pre>= f.simple_fields_for :children do |child_form|
  = child_form.input :age</pre>


<p>You can now have as many children as you want and the form will pass the correct params back.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=iPq4cRaNlqI:EGO0Df7vdZo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2012/01/16/mongoid-embedded-documents-embeds_many-form-example-using-simple_form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chromaroma goes from Beta to Live</title>
		<link>http://blog.dynamic50.com/2011/04/06/chromaroma-goes-from-beta-to-live/</link>
		<comments>http://blog.dynamic50.com/2011/04/06/chromaroma-goes-from-beta-to-live/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 10:09:07 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[anup narkhede]]></category>
		<category><![CDATA[chromaroma]]></category>
		<category><![CDATA[dynamic50]]></category>
		<category><![CDATA[mudlark]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1129</guid>
		<description><![CDATA[We are proud to announce the full launch of Chromaroma. Here at Dynamic50 we have been working with Mudlark on the development of Chromaroma for quite some time now. Dynamic50 took over the development work in September 2010 and several members of our team here have had the opportunity to work on it. Development was [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.dynamic50.com/wp-content/uploads/2011/04/chromaroma_RJ_33.jpg"><img src="http://blog.dynamic50.com/wp-content/uploads/2011/04/chromaroma_RJ_33-300x200.jpg" alt="chromaroma RJ 33 300x200 Chromaroma goes from Beta to Live" title="Chromaroma Launch" width="300" height="200" class="alignnone size-medium wp-image-1149" /></a></p>

<p>We are proud to announce the full launch of <a href="http://www.chromaroma.com">Chromaroma</a>. Here at <a href="http://dynamic50.com">Dynamic50</a> we have been working with Mudlark on the development of <a href="http://www.chromaroma.com">Chromaroma</a> for quite some time now. Dynamic50 took over the development work in September 2010 and several members of our team here have had the opportunity to work on it.</p>

<p>Development was led by one of our senior developers, <a href="http://www.anup.info/">Anup Narkhede</a>, who has been working on the project since when we took it on in September. But along with <a href="http://twitter.com/railsbob">Anup</a>, special thanks must also go to  <a href="http://twitter.com/andyw8">Andy</a>, <a href="http://twitter.com/scottnicolson">Scott</a>, and <a href="http://twitter.com/botanicus">Jakub</a> who also had a hand in making Chromaroma what it is today!</p>

<p>Since September, Chromaroma has seen huge improvements including two complete UI changes, new missions, new transport types, subscriptions and payment plans, as well as a lot of optimisation of the game mechanics engine. But to be honest, this barely covers what has been achieved!</p>

<p>In case you are not aware of Chromaroma, here is an excerpt from the press release:</p>

<p><em>&#8220;Chromaroma is an online multiplayer game using Oyster Cards and Bike Hire Keys. It allows users to embark on missions, collect items, gain points and meanwhile support your team members or make it all the more difficult for your opposition.</p>

<p>As teams players can capture stations and aim to dominate the map. It is a game: Risk meets Foursquare, a 21st century twist on a classic game and giving users the opportunity to conquer the London Underground network.<br />
Players are divided up into colour-coded teams. When each player taps in or out of a station they gain points. The team that gains the most points then &#8216;owns&#8217; that station. At the end of the season the team with the most stations wins the game and takes London.</p>

<p>But Chromaroma is not just a game, it is a storytelling platform from where people can play as fictional characters or as themselves in the physical world.&#8221;</em></p>

<p>The press launch was this morning, which marks the official transition from beta to live. Congratulations to all involved, and thanks to Mudlark for choosing Dynamic50 to be part of such an exciting project!</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=c9ZD0XqJj7c:pc_JfvZLmms:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/04/06/chromaroma-goes-from-beta-to-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Gem for the Police API</title>
		<link>http://blog.dynamic50.com/2011/03/23/ruby-gem-for-the-police-api/</link>
		<comments>http://blog.dynamic50.com/2011/03/23/ruby-gem-for-the-police-api/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 18:53:21 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[police]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1126</guid>
		<description><![CDATA[Richard from Dynamic50 has just released a ruby gem for the Police API available here: https://github.com/hookercookerman/oldbill. It allows you to hook into the new Police API service to find out about crime in your local area. To get started, simply register for an API key here: http://policeapi2.rkh.co.uk/api/docs/signup/ and then add the gem to your Gemfile: [...]]]></description>
			<content:encoded><![CDATA[<p>Richard from <a href="http://dynamic50.com">Dynamic50</a> has just released a ruby gem for the Police <span class="caps">API </span>available here: <a href="https://github.com/hookercookerman/oldbill">https://github.com/hookercookerman/oldbill</a>. It allows you to hook into the new Police <span class="caps">API </span>service to find out about crime in your local area.</p>

<p>To get started, simply register for an <span class="caps">API </span>key here: <a href="http://policeapi2.rkh.co.uk/api/docs/signup/">http://policeapi2.rkh.co.uk/api/docs/signup/</a> and then add the gem to your Gemfile:</p>


<pre>gem &quot;oldbill&quot;</pre>


<p>or you can just install it from the command line:</p>


<pre>gem install oldbill</pre>



<p>and then follow the instructions on the readme at <a href="https://github.com/hookercookerman/oldbill">https://github.com/hookercookerman/oldbill</a></p>

<p>The Police <span class="caps">API </span>allows you to download data about crime localised to your area within a date range, and is data direct from the UK police service. Enjoy!</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=yYPM1kVnAiE:eIbFx8SbdE0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/03/23/ruby-gem-for-the-police-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Training weekends</title>
		<link>http://blog.dynamic50.com/2011/03/15/ruby-on-rails-training-weekends/</link>
		<comments>http://blog.dynamic50.com/2011/03/15/ruby-on-rails-training-weekends/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 10:37:47 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[dynamic50]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1122</guid>
		<description><![CDATA[****AMENDED TIMES********************* The date of this course has been moved to 16th &#8211; 17th April, details and booking is available at http://rubyonrailstraining.eventbrite.com/ ****************************************** Following on from our last post and the feedback we received, we have decided to move the Rails training course to run over a weekend rather than during the week. We have [...]]]></description>
			<content:encoded><![CDATA[<p>****AMENDED <span class="caps">TIMES</span>*********************<br />
The date of this course has been moved to 16th &#8211; 17th April, details and booking is available at <a href="http://rubyonrailstraining.eventbrite.com/">http://rubyonrailstraining.eventbrite.com/</a><br />
******************************************</p>

<p>Following on from our last post and the feedback we received, we have decided to move the Rails training course to run over a weekend rather than during the week.</p>

We have two weekends in mind:<br />
<ul>
	<li><del datetime="2011-04-07T13:33:59+00:00">9-10th April</del></li>
	<li><del datetime="2011-04-07T13:33:59+00:00">23rd-24th April</del></li>
        <li>16-17th April</li>
</ul>

<p>We will be running <em>small</em> classes so we can pack as this makes for faster learning and a more one-on-one feel to it!</p>

<p>The course content will be the same for both weekends:<br />
A basic understanding or programming will help but is not mandatory.</p>

The training course will cover Rails 3 including the following topics:<br />
<ul>
<li>Environment Setup</li>
<li>Version Control overview</li>
<li>Ruby kick start</li>
<li>Introduction to the language</li>
<li>Rails <span class="caps">MVC </span>overview and anatomy of a rails application</li>
<li>Creating a rails project</li>
<li>Using the generators<li>
<li>Introduction to specs and tests</li>
<li>Introduction to <span class="caps">REST </span>and Restful controllers</li>
<li>Introduction to plugins, engines, and gems</li>
<li>Learning to use Active model and active record</li>
<li>Creating Views, Layouts, and reusable snippets (partials)</li>
<li>Deployment with Capistrano and Git</li>
</ul>

<p>Spaces are booking up fast, so to reserve your space go to <a href="http://rubyonrailstraining.eventbrite.com/">http://rubyonrailstraining.eventbrite.com/</a>, send us an <a href="mailto:training@dynamic50.com">email</a> or call us on 0208 686 6372</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=Id8wjIkFj9g:qHRwsA6_HJ4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/03/15/ruby-on-rails-training-weekends/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Training Course</title>
		<link>http://blog.dynamic50.com/2011/02/22/ruby-on-rails-training-course/</link>
		<comments>http://blog.dynamic50.com/2011/02/22/ruby-on-rails-training-course/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 16:11:45 +0000</pubDate>
		<dc:creator>scottnicolson</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1076</guid>
		<description><![CDATA[We are holding a ruby on rails kick start training course here at Dynamic50.  If you want to go from zero to hero in a short amount of time <a href="http://blog.dynamic50.com/2011/02/22/ruby-on-rails-training-course/">See what you will learn.</a>]]></description>
			<content:encoded><![CDATA[<p>****AMENDED <span class="caps">TIMES</span>*********************<br />
The date of this course has been moved to 16th &acirc;�� 17th April, details and booking is available at http://rubyonrailstraining.eventbrite.com/<br />
******************************************</p>

<p>We are holding a beginners to intermediate ruby on rails training course here at Dynamic50 on the <del datetime="2011-04-07T13:41:41+00:00">29th of March. The course will last 3 days and will cost &pound;500 ex <span class="caps">VAT</span></del>. We have 4 places left so if you are interested in attending please get in contact by sending us an <a title="Dynamic 50 Email" href="mailto:contactus@dynamic50.com?subject=training course enquiry">email</a>.</p>

<p>A basic understanding or programming will help but is not mandatory.</p>

The training course will cover Rails 3 including the following topics:<br />
<ul style="list-style: disc; margin-left: 25px;">
	<li>Environment Setup</li>
	<li>Version Control overview</li>
	<li>Ruby kick start
<ul style="list-style: disc; margin: 0 0 0 25px;">
	<li>Introduction to the language</li>
</ul>
</li>
	<li>Rails <span class="caps">MVC </span>overview and anatomy of a rails application
<ul style="list-style: disc; margin: 0 0 0 25px;">
	<li>Creating a rails project</li>
	<li>Using the generators</li>
</ul>
</li>
	<li>Introduction to specs and tests</li>
	<li>Introduction to <span class="caps">REST </span>and Restful controllers</li>
	<li>Introduction to plugins, engines, and gems</li>
	<li>Learning to use Active model and active record</li>
	<li>Creating Views, Layouts, and reusable snippets (partials)</li>
	<li>Deployment with Capistrano and Git</li>
</ul>
Do bring your running shoes as we will be covering a lot of ground quite quickly!<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=a3pog4E-BvI:Bcr4OdQoRwo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/02/22/ruby-on-rails-training-course/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Redirect all requests for www. to root domain with Heroku</title>
		<link>http://blog.dynamic50.com/2011/02/22/redirect-all-requests-for-www-to-root-domain-with-heroku/</link>
		<comments>http://blog.dynamic50.com/2011/02/22/redirect-all-requests-for-www-to-root-domain-with-heroku/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 11:32:49 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[heroku]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[301 redirect]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1072</guid>
		<description><![CDATA[Following on from my post the other day regarding Heroku wildcards I thought it would be worth looking at redirecting either www to root or vice-versa. Heroku doesn&#8217;t give you the ability to touch the VHost settings, which is where this sort of thing is usually done, but this is not a problem as you [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from my post the other day regarding <a href="http://blog.dynamic50.com/2011/02/15/ssl-on-wildcard-domains-on-heroku-using-godaddy/">Heroku wildcards</a> I thought it would be worth looking at redirecting either www to root or vice-versa.</p>

<p>Heroku doesn&#8217;t give you the ability to touch the VHost settings, which is where this sort of thing is usually done, but this is not a problem as you can simply use a bit of rack middleware to do the same thing. If you are looking for more complex rules than simply a rack rewrite of www to root, the I would suggest using something like <a href="https://github.com/jtrupiano/rack-rewrite">John Trupianos&#8217; Rack Rewrite</a>. </p>

<p>Anyway the idea behind a rack rewrite on this is that so for example:</p>


<pre>www.dynamic50.com</pre>


<p>gets 301 redirected to</p>


<pre>dynamic50.com</pre>


<p>What this means is that you don&#8217;t end up with duplicate content on both www and the root domain, which is no good for <span class="caps">SEO </span>or for looking at your analytics.</p>

<p>So what do I write? Well first place this bit of code in &#8220;lib/middleware/www_middleware.rb&#8221;</p>


<pre>
class WwwMiddleware
  def initialize(app)
    @app = app
  end

  def call(env)
    request = Rack::Request.new(env)
    if request.host.starts_with?(&quot;www.&quot;)
      [301, {&quot;Location&quot; =&gt; request.url.sub(&quot;//www.&quot;, &quot;//&quot;)}, self]
    else
      @app.call(env)
    end
  end

  def each(&amp;block)
  end
end
</pre>



<p>And place the following in your &#8220;config/application.rb&#8221;</p>


<pre>
config.autoload_paths += %W( #{ config.root }/lib/middleware )
</pre>



<p>And this in your &#8220;config/environments/production.rb&#8221;</p>


<pre>
config.middleware.use &quot;WwwMiddleware&quot;
</pre><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=yXRVJLBU_Lo:-fN8gbEQB6k:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/02/22/redirect-all-requests-for-www-to-root-domain-with-heroku/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Validations On The Fly</title>
		<link>http://blog.dynamic50.com/2011/02/21/validations-on-the-fly/</link>
		<comments>http://blog.dynamic50.com/2011/02/21/validations-on-the-fly/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 19:14:01 +0000</pubDate>
		<dc:creator>Richard Hooker</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[toystore ActiveModel validations]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1060</guid>
		<description><![CDATA[When I was creating the CarbonCalculated API (Carbon Calculation Platform) I needed to give an instance of a model its&#8217; own validations; so in a nut shell each instance can have a completely different set of validations compared to the next one; so the question is: how do we store validations and make sure the [...]]]></description>
			<content:encoded><![CDATA[<p>When I was creating the <a href="http://www.carboncalculated.com/platform/api">CarbonCalculated <span class="caps">API</span></a> (Carbon Calculation Platform) I needed to give an instance of a model its&#8217; own validations; so in a nut shell each instance can have a completely different set of validations compared to the next one; so the question is: how do we store validations and make sure the passed instance comes back as valid? when parsed certain values</p>

<h1>Real World</h1>

<p>click <a href="http://miniapps.carboncalculated.com/car/calculation/answers/new">here</a> if you wish to see a real work example;</p>

<p>Ok what does this example have todo with creating validation on the fly???</p>

<p>In <a href="http://www.carboncalculated.com/platform/api">CarbonCalculated</a> we get a <span class="caps">CO2 </span>result via sending a request to calculator giving some parameters via a <span class="caps">HTTP GET</span> Request; If you looked at the example that is essentially 1 calculator with many computations. So what?? Well in our carbon applications I don&#8217;t have to do any logic to try to determine what computation the user wishes to answer; Plan Train Bus Whatever; because the Calculator will ask the Computations which one is valid; Anyway enough<br />
ranting lest see some code!!!</p>

<p>This is not the implementation in CarbonCalculated however same principle; CarbonCalculated <span class="caps">API </span>uses a little more magic for custom validators and uses mongomapper etc;</p>

<h1>Storing And Using Validations</h1>


<pre>  require 'adapter/memory'
  require 'toystore'
  require 'ostruct'

  class Validation
    include Toy::Store
    store :memory, {}

    # == Attributes
    attribute :name, String
    attribute :message, String
    attribute :has_validator, Boolean, :default =&amp;gt; false # For custom Validators
    attribute :key_name, String, :default =&amp;gt; false
  end

  # == Computation Model
  class Computation
    include Toy::Store
    store :memory, {}

    # == Attributes
    attribute :name, String
    embedded_list :validations
  end

  # This is the class that we want a result from it uses the
  class Answer

    attr_accessor :computation, :attributes

    def initialize(computation, attributes = {})
      @attributes = attributes
      @computation = computation
    end

    def validations
      @computation.validations
    end

    # @return [Class]
    def build_validator
      useable_validations = validations
      Class.new(::OpenStruct) do
        include ActiveModel::Validations
        extend ActiveModel::Naming

        def self.name
          &quot;Answer&quot;
        end

        # may wish to override to support custom validations
        def self.validation_validator(val)
          val[&quot;key_name&quot;].to_sym
        end

        def self.evaled_validation_options(validation_options)
          new_options = {}
          validation_options.each_pair do |key, value|
            new_options.merge!({key.to_sym =&amp;gt; value.is_a?(String) ? eval(value) : value})
          end
          new_options
        end

        useable_validations.each do |validation|
          self.send(validation.name, validation_validator(validation))
        end
      end
    end

    def validator
      @validator ||= build_validator.new(@attributes)
    end

    def valid?
      validator.valid?
    end

    def errors
      validator.errors
    end
  end

  @computation = Computation.create!(
    :name =&amp;gt; &quot;simple computation&quot;,
    :validations =&amp;gt; [Validation.new(:name =&amp;gt; &quot;validates_presence_of&quot;, :key_name =&amp;gt; &quot;name&quot;)]
  )

  a = Answer.new(@computation, {})
  a.valid?
  # false
  a.errors.full_messages
  # Name can't be blank

  a = Answer.new(@computation, {:name =&amp;gt; &quot;beans&quot;})
  a.valid?
  # true</pre><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=yVPsWgEBPzY:ZPdWYUqG5gA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/02/21/validations-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSL on wildcard domains on Heroku using GoDaddy</title>
		<link>http://blog.dynamic50.com/2011/02/15/ssl-on-wildcard-domains-on-heroku-using-godaddy/</link>
		<comments>http://blog.dynamic50.com/2011/02/15/ssl-on-wildcard-domains-on-heroku-using-godaddy/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 13:06:18 +0000</pubDate>
		<dc:creator>Jason Green</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[godaddy]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[wildcard]]></category>

		<guid isPermaLink="false">http://blog.dynamic50.com/?p=1037</guid>
		<description><![CDATA[We have just finished setting up ssl on wildcard domains for a client. We have set this up on Heroku so that you have ssl on all top level subdomains. For example: *.myapp.com demo.myapp.com hello.myapp.com secure.myapp.com This is a fairly straightforward process, however there appears to be no good documentation online on how to do [...]]]></description>
			<content:encoded><![CDATA[<p>We have just finished setting up ssl on wildcard domains for a client. We have set this up on Heroku so that you have ssl on all top level subdomains.<br />
For example:</p>


<pre>*.myapp.com
demo.myapp.com
hello.myapp.com
secure.myapp.com</pre>


<p>This is a fairly straightforward process, however there appears to be no good documentation online on how to do it for wildcard domains.</p>

<p>As much as I dislike GoDaddy with their automatic renewal on everything and massive upsell, they are the cheapest and easiest to get started with on an <span class="caps">SSL </span>wildcard package. Just make sure you don&#8217;t end up buying something irrelevant during the payment process!<br />
I bought the &#8220;Standard (turbo) wildcard <span class="caps">SSL</span> 1 year&#8221; which costs around &Acirc;&pound;124 excl <span class="caps">VAT.</span> I tried 123reg previously but it seems that 123reg certificates do not work completely cross browser.</p>

<p>So to get started lets generate a <span class="caps">CSR.</span> I am assuming Mac <span class="caps">OSX </span>for this, although this should also work on Linux, but probably not on Windoze.<br />
Do the following:</p>


<pre>mkdir sslcerts;
cd sslcerts;</pre>


<p>Now generate a key. Choose a passphrase you will remember when it asks you for one</p>


<pre>openssl genrsa -des3 -out mykey.key 2048;</pre>


<p>And generate the <span class="caps">CSR </span>(using the passphrase you just entered). As you are doing a wildcard domain make sure the organisational unit name and the common name are the same and are pre-pended with a * (see below for example).</p>


<pre>openssl req -new -key mykey.key -out mycsr.csr;

Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]:London
Locality Name (eg, city) []:Croydon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Company Ltd
Organizational Unit Name (eg, section) []:*.exampleapp.com
Common Name (eg, YOUR name) []:*.exampleapp.com
Email Address []:support@exampleapp.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:</pre>


<p>Leave the challenge and company name blank.</p>

<p>Double check you got this all correct as when you paste your <span class="caps">CSR </span>in, if you get the domain wrong you will have to request a refund and then reapply, not the quickest of processes! If you do this wrong, the best way to get a refund on it is to call them up.<br />
You now paste your <span class="caps">CSR </span>up to the GoDaddy panel and then go through a series of confirmations on your domain. When you have finished these, the certificate will be issued.</p>

<p>Download your certificate and intermediate key (they come in a bundled dir). When you download choose &#8220;Other&#8221; as the format. You need to combine the two certificates so first move the two to your directory and then combine them:</p>


<pre>cat myapp.com.crt gd_bundle.crt &amp;gt; myapp_bundle.crt;</pre>


<p>Also bundle your cert and key together:</p>


<pre>cat myapp_bundle.crt mykey.key &amp;gt; mypem.pem;</pre>


<p>Finally we now need to remove the passphrase from the certificates:</p>


<pre>openssl rsa -in mypem.pem -out final.pem;
openssl x509 -in mypem.pem &amp;gt;&amp;gt;final.pem;
openssl rsa -in mykey.key -out final.key;</pre>


<p>And that is your certificates done and ready to upload to heroku.<br />
Now on heroku log in and check that you have the Custom Domains and Custom Domains and wildcards add-ons and that your domain names are set correctly (ie that you have *.myapp.com and myapp.com set as domain names).</p>

<p>Now upload your ssl certs to heroku:</p>


<pre>heroku ssl:add final.pem final.key</pre>


<p>From you heroku control panel add Hostname <span class="caps">SSL.</span> Heroku will then send you an email with a <span class="caps">DNS </span>address for your app such as:</p>


<pre>appid42352herokucom-324234.us-east-1.elb.amazonaws.com</pre>


<p>Make sure you domain is pointing to this, so remove the existing <span class="caps">CNAME </span>record you have for your wildcard subdomains:</p>


<pre>*.myapp.com.  -&amp;gt; proxy.heroku.com.</pre>


<p>And create a <span class="caps">CNAME </span>record to make it point to the new amazon appid:</p>


<pre>*.myapp.com. -&amp;gt; appid419658herokucom-96892355.us-east-1.elb.amazonaws.com.</pre>


<p>Now this should all be working and after waiting for your <span class="caps">CNAME </span>to propagate, you should now be able to visit mysubdomain.myapp.com using ssl (https) and it should be valid and secure :-)</p>

<p>As a final quick hint, if you want to make sure that http requests get redirected to https automatically put the following in &#8220;lib/middleware/force_ssl.rb&#8221;:</p>


<pre>class ForceSSL
  def initialize(app)
    @app = app
  end

  def call(env)
    req = Rack::Request.new(env)
    if env['HTTPS'] == 'on' || env['HTTP_X_FORWARDED_PROTO'] == 'https'
      @app.call(env)
    else
      [301, { &quot;Location&quot; =&amp;gt; req.url.gsub(/^http:/, &quot;https:&quot;) }, []]
    end
  end
end</pre>


<p>The following into &#8220;config/application.rb&#8221;:</p>


<pre>config.autoload_paths += %W( #{ config.root }/lib/middleware )</pre>


<p>And the following into &#8220;config/environments/production.rb&#8221;:</p>


<pre>config.middleware.use &quot;ForceSSL&quot;</pre>


<p>Now your app will automatically route any http request to https, meaning ssl the whole time :-)<br />
I grabbed this little bit of code for the <span class="caps">SSL </span>from somewhere but can&#8217;t remember where so please comment if you are the poster and I will credit you, thanks!</p>

<p><strong>edit</strong> the ssl was taken from: Simone Carletti @ stackoverflow:&Acirc;&nbsp;<a rel="nofollow" href="http://stackoverflow.com/questions/3861772/force-ssl-using-ssl-requirement-in-rails-app">http://stackoverflow.com/questions/3861772/force-ssl-using-ssl-requirement-in-rails-app</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dynamic50?a=kcKLJB0PwL8:pq-wlAnVwyY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dynamic50?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.dynamic50.com/2011/02/15/ssl-on-wildcard-domains-on-heroku-using-godaddy/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
