<?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"
	>

<channel>
	<title>myGrid developer blog</title>
	<atom:link href="http://www.mygrid.org.uk/dev/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mygrid.org.uk/dev/blog</link>
	<description>The developers of myGrid tell of their quest of the code</description>
	<pubDate>Fri, 16 Dec 2011 12:37:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Ruby on Rails and IIS on Windows 7</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=41</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=41#comments</comments>
		<pubDate>Fri, 16 Dec 2011 12:37:24 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=41</guid>
		<description><![CDATA[Here are the steps I needed to install ruby 1.8, rails 2.3, sqlserver to run our https://github.com/myGrid/methodbox codebase on a Windows 7 platform and run  it all under IIS. It should also work for any rails 2 or 3 project.  If you use rmagick or libxml-ruby then pay attention to the installing gems part [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the steps I needed to install ruby 1.8, rails 2.3, sqlserver to run our https://github.com/myGrid/methodbox codebase on a Windows 7 platform and run  it all under IIS. It should also work for any rails 2 or 3 project.  If you use rmagick or libxml-ruby then pay attention to the installing gems part for some dlls you need to install along with where to get them.</p>
<p>So, having tried various solutions involving fastcgi and url rewrite which I could not get to work on IIS 7.5 under Windows 7 I found <a title="Helicon Tech Zoo" href="http://www.helicontech.com/zoo" target="_blank">http://www.helicontech.com/zoo</a> . I&#8217;ve seen the people behind it on various other posts on msdn etc so there is some history of them working on IIS, fastcgi and url rewrite. In fact I think they have had a url rewrite product available for a number of years.</p>
<p>* Install Rails</p>
<p>1) Install the Web Platform Installer from http://www.microsoft.com/web/downloads/platform.aspx<br />
2) Add http://www.helicontech.com/zoo/feed as a new feed<br />
3) From the zoo tab select Blank Ruby on Rails Rails project and Ruby1.8 and click the install button. It will also install other dependencies.<br />
4) When installing the blank project it will pop up and ask you where to put it along with other required details like the name. Make a note of where the project lives since we need a couple of files from it.<br />
5) From the blank rails project we need the web.config files in the projects root and public directories.  Place these in the same place in your rails project directories.  To use Ruby1.9 we need to replace ruby.1.9.pipe in the web.config in the projects root directory with ruby.1.8.pipe. You may also have to add the path to ruby&#8217;s bin directory to your environment variables - C:\Ruby18\bin or C:\Ruby19\bin<br />
6) Ensure that the projects directories are writeable by the IIS_IUSRS user.<br />
7) Add the project to IIS with the project path pointing to the rails projects root directory (not public like you would with a rails project under apache).</p>
<p>* Install Git</p>
<p>This is used for version control and can be found on http://git-scm.com/ Install the version marked &#8216;Full installer for official Git for Windows 1.7.8&#8242; or similar (version name might be different).</p>
<p>* Install required gems (libxml and imagemagick specific instructions)</p>
<p>There are various 3rd party dependencies that the gems that MethodBox requires including imagemagick (ie. rmagick) and libxml-ruby. On windows this requires a little bit of user intervention during the install process. Go to http://www.imagemagick.org/script/binary-releases.php?ImageMagick=uteqfietdab37ghqrvfuvoul55#windows and download http://www.imagemagick.org/download/binaries/ImageMagick-6.7.3-7-Q16-windows-dll.exe<br />
Double click and go through the installer, selecting to install C and C++ header files and libraries from the additional options page<br />
add environment variable CPATH=\path\to\imagemagick\include and LIBRARY_PATH=\path\to\imagemagick\lib</p>
<p>There is a high chance that the libxml-2.2.dll needed for libxml-ruby is not present in the lib folder and will pop up an error.  The dll can be found in C:\Ruby18\lib\ruby\gems\1.8\gems\libxml-ruby-2.2.0-x86-mingw32\lib\libs\  Copy the libxml, iconv and zlib dlls and put in the C:\Ruby18\bin folder.</p>
<p>Note: If you are not using mysql then comment any mysql gem out of the  Gemfile. Otherwise the system may complain about libmysql.dll missing.  If you are using mysql you need to copy  the dll from the mysql/bin folder to the ruby lib folder.</p>
<p>* SQL server and rails</p>
<p>1) Find out your SQL server details. If your SQL server instance has not been allowed through the firewall then you need to find out its details: open up the sqlserver management console (which you can install along with sqlserver express via the Web Platform Installer - I recommend this way, downloading on its own and installing does not work correctly) and look at your db details.<br />
2) Set up a Data Source Name (DSN) for your ODBC connection.  This is not that well documented so you need to find the C:\Windows\sysWOW64 directory and start the odbcad32 programme.  Then you add a system DSN for your instance of sqlserver.<br />
3) Set up your rails projects database.yml as normal with the following records:</p>
<p>adapter: sqlserver<br />
mode: odbc<br />
dsn: sqlserverapp-dsn (the one you created earlier)<br />
username: user<br />
password: secret<br />
host: localhost (or whatever)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=41</wfw:commentRss>
		</item>
		<item>
		<title>Ruby, Windows and RMagick</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=40</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=40#comments</comments>
		<pubDate>Thu, 24 Nov 2011 10:00:06 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[gem]]></category>

		<category><![CDATA[image magick]]></category>

		<category><![CDATA[install]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rmagick]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=40</guid>
		<description><![CDATA[Been doing a lot of rails work on windows recently and ran into some issues that needed solved.  Just like on Unix, to get the RMagick gem working on a windows platform you need to install ImageMagick.  Go to http://www.imagemagick.org/script/binary-releases.php?ImageMagick=uteqfietdab37ghqrvfuvoul55#windows and download http://www.imagemagick.org/download/binaries/ImageMagick-6.7.3-7-Q16-windows-dll.exe
Double click and go through the installer, selecting to install C and C++ [...]]]></description>
			<content:encoded><![CDATA[<p>Been doing a lot of rails work on windows recently and ran into some issues that needed solved.  Just like on Unix, to get the RMagick gem working on a windows platform you need to install ImageMagick.  Go to http://www.imagemagick.org/script/binary-releases.php?ImageMagick=uteqfietdab37ghqrvfuvoul55#windows and download http://www.imagemagick.org/download/binaries/ImageMagick-6.7.3-7-Q16-windows-dll.exe</p>
<p>Double click and go through the installer, selecting to install C and C++ header files and libraries from the additional options page (this is very important)</p>
<p>Then add environmant variable CPATH=\path\to\imagemagick\include and LIBRARY_PATH=\path\to\imagemagick\lib</p>
<p>You can then &#8216;gem install rmagick&#8217; and it will build it using the native image magick libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=40</wfw:commentRss>
		</item>
		<item>
		<title>Sun/Oracle Java on Ubuntu</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=39</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=39#comments</comments>
		<pubDate>Mon, 04 Apr 2011 15:17:49 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[10.04]]></category>

		<category><![CDATA[install]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[lucid lynx]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=39</guid>
		<description><![CDATA[Ubuntu Lucid Lynx (10.04) does not have the sun java repositories available by default.  You need to add them like this:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
Then update the packages available:
sudo apt-get update
Then you can install Sun&#8217;s (Oracles?) Java
sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin
]]></description>
			<content:encoded><![CDATA[<p>Ubuntu Lucid Lynx (10.04) does not have the sun java repositories available by default.  You need to add them like this:</p>
<p><code>sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"</code></p>
<p>Then update the packages available:</p>
<p><code>sudo apt-get update</code></p>
<p>Then you can install Sun&#8217;s (Oracles?) Java</p>
<p><code>sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=39</wfw:commentRss>
		</item>
		<item>
		<title>Bundler, OSX and the MysqlCompat::MysqlRes error</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=38</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=38#comments</comments>
		<pubDate>Fri, 25 Mar 2011 11:53:18 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[64bit]]></category>

		<category><![CDATA[bundle]]></category>

		<category><![CDATA[bundler]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[osx]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=38</guid>
		<description><![CDATA[If you get the uninitialized constant MysqlCompat::MysqlRes error when trying to run your Rails app all the evidence points to it being a 32 v 64 bit issue.  However, I had built mysql for the x86_64 architecture and the mysql gem installed was also for 64 bits.  So why was I still getting this error.  [...]]]></description>
			<content:encoded><![CDATA[<p>If you get the <em>uninitialized constant MysqlCompat::MysqlRes</em> error when trying to run your Rails app all the evidence points to it being a 32 v 64 bit issue.  However, I had built mysql for the x86_64 architecture and the mysql gem installed was also for 64 bits.  So why was I still getting this error.  It turns out that bundler was building the mysql gem in 32 bits.  OSX Snow Leopard ships with Ruby in a universal binary containing the ppc, i386 and x86_64 binaries and for whatever reason <code>bundle install</code> was using the 32 bit ruby and re-building everything even though I had the gems already installed in the system in 64 bit mode.  This could be because the user doing the building was 1) unprivileged and 2) using <code>bundle install \--path=vendor</code>.  Maybe bundler was picking the first version of ruby that was appropriate to the platform.  However, doing <code>bundle install \--deployment</code> also had the same issues. I have no idea why it was rebuilding gems that already existed on my system.  The way to get round it was to force bundler to build in 64 bits by using <code>env ARCHFLAGS='-arch x86_64' bundle install --path=vendor</code><br />
Maybe the best idea is not to use the Ruby that ships with OSX and build one appropriate to your environment in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=38</wfw:commentRss>
		</item>
		<item>
		<title>Tab navigation and tooltips</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=37</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=37#comments</comments>
		<pubDate>Thu, 02 Sep 2010 10:31:44 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[tab]]></category>

		<category><![CDATA[tabifier]]></category>

		<category><![CDATA[tooltip]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=37</guid>
		<description><![CDATA[We use the tabifier javascript from barelyFitz in a few places in MethodBox.  However, I wanted it to have a different, more descriptive tooltip than the tab title.  The default code doesn&#8217;t seem to do this so I added a couple of little changes to make this happen.
You can see the complete file here but [...]]]></description>
			<content:encoded><![CDATA[<p>We use the tabifier javascript from <a title="Barely Fitz tabifier" href="http://www.barelyfitz.com/projects/tabber/">barelyFitz</a> in a few places in <a title="MethodBox survey browsing and sharing" href="http://www.methodbox.org">MethodBox</a>.  However, I wanted it to have a different, more descriptive tooltip than the tab title.  The default code doesn&#8217;t seem to do this so I added a couple of little changes to make this happen.</p>
<p>You can see the complete file <a title="MethodBox tabifier code" href="http://code.google.com/p/methodbox/source/browse/trunk/methodbox/public/javascripts/tabber-new.js">here</a> but below is a quick synopsis of the changes:</p>
<p>added a boolean to keep track of whether you want a different tooltip than the tab title:</p>
<p><code> this.differentTooltip = true;</code></p>
<p>if this isn&#8217;t the behaviour you wanted then that&#8217;s ok:</p>
<p><code> if (!this.differentTooltip) {<br />
t.headingText = t.div.title;<br />
}<br />
</code></p>
<p>however, if the tooltip is to be different then make sure the<br />
link for the tab is correct:</p>
<p><code> if (this.differentTooltip) {<br />
DOM_a.title = t.tooltipText;<br />
} else {<br />
DOM_a.title = t.headingText;<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=37</wfw:commentRss>
		</item>
		<item>
		<title>Looping over javascript arrays with Prototype framework</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=36</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=36#comments</comments>
		<pubDate>Mon, 16 Aug 2010 15:11:23 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[for loop]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=36</guid>
		<description><![CDATA[Had an array in javascript and tried to loop over it using
for (x in array){

...some code

}
I was confused why it seemed to have lots more members than I had put in with contents that seemed to be functions.  So I used console.log and firebug to print out the array members and saw that they were [...]]]></description>
			<content:encoded><![CDATA[<p>Had an array in javascript and tried to loop over it using</p>
<pre><code>for (x in array){

...some code

}</code></pre>
<p>I was confused why it seemed to have lots more members than I had put in with contents that seemed to be functions.  So I used console.log and firebug to print out the array members and saw that they were the methods you could call on an array object.</p>
<p>A quick google revealed that (<a title="prototype array api" href="http://www.prototypejs.org/api/array">see here</a>)</p>
<blockquote><p>using <code>for</code>…<code>in</code> on arrays when using Prototype will enumerate all extended methods as well, such as those coming from the <a href="http://www.prototypejs.org/api/enumerable"><code>Enumerable</code></a> module, and those Prototype puts in the <code>Array</code> namespace</p></blockquote>
<p>and that the best (only?) way to do it in Prototype is</p>
<pre><code class="javascript">myArray.each<span class="brackets">(</span><span class="keywords">function</span><span class="brackets">(</span>item<span class="brackets">)</span> {

<span class="comment">// Your code working on item here&#8230;

</span>}<span class="brackets">)</span>;

</code></pre>
<p>It&#8217;s all sorted now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=36</wfw:commentRss>
		</item>
		<item>
		<title>RServe on OSX Snow Leopard</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=34</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=34#comments</comments>
		<pubDate>Mon, 24 May 2010 11:09:34 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=34</guid>
		<description><![CDATA[I always seem to have some difficulty getting the Rserve component of the R stats library up and running on OSX.  Installing it via install.packages(&#8221;rserve&#8221;) from within R  appears to work but when running R CMD Rserve I usually get some sort of error like:
/Library/Frameworks/R.framework/Resources/bin/Rcmd: line 62: exec: Rserve: not found
Compiling from source using the [...]]]></description>
			<content:encoded><![CDATA[<p>I always seem to have some difficulty getting the Rserve component of the R stats library up and running on OSX.  Installing it via install.packages(&#8221;rserve&#8221;) from within R  appears to work but when running R CMD Rserve I usually get some sort of error like:</p>
<p>/Library/Frameworks/R.framework/Resources/bin/Rcmd: line 62: exec: Rserve: not found</p>
<p>Compiling from source using the download from <a title="Rosuda" href="http://rosuda.org/Rserve/">http://rosuda.org/Rserve/</a> never seems to work with all sorts of C related horror.</p>
<p>However, the Rserve component actually was installed but it looks like the paths/links were not quite right.  Typing this:</p>
<p>R CMD /Library/Frameworks/R.framework/Resources/library/Rserve/libs/x86_64/Rserve.so</p>
<p>Got everything up and running. Doing this:</p>
<p>cp /Library/Frameworks/R.framework/Resources/library/Rserve/libs/x86_64/Rserve-bin.so /Library/Frameworks/R.framework/Resources/bin/Rserve</p>
<p>fixes it a bit more permanently</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=34</wfw:commentRss>
		</item>
		<item>
		<title>Obscure mysql bug number 1153 (08S01) (my packet&#8217;s too big)</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=33</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=33#comments</comments>
		<pubDate>Fri, 21 May 2010 14:14:37 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[import]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[packet]]></category>

		<category><![CDATA[size]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=33</guid>
		<description><![CDATA[Ok, here&#8217;s one you don&#8217;t see every day.
Importing a mysql dumpfile results in &#8220;ERROR 1153 (08S01) at line 265: Got a packet bigger than &#8216;max_allowed_packet&#8217; bytes&#8221;
Errm.
Log in to a mysql console,
enter the magic commands:
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
Modify your import to include the command:
&#8211;max_allowed_packet=100M
so you have something like
mysql &#8211;max_allowed_packet=100M -u user -p db_name &#60; dump.sql
Try [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, here&#8217;s one you don&#8217;t see every day.</p>
<p>Importing a mysql dumpfile results in &#8220;ERROR 1153 (08S01) at line 265: Got a packet bigger than &#8216;max_allowed_packet&#8217; bytes&#8221;</p>
<p>Errm.</p>
<p>Log in to a mysql console,</p>
<p>enter the magic commands:</p>
<p>set global net_buffer_length=1000000;</p>
<p>set global max_allowed_packet=1000000000;</p>
<p>Modify your import to include the command:</p>
<p>&#8211;max_allowed_packet=100M</p>
<p>so you have something like</p>
<p>mysql &#8211;max_allowed_packet=100M -u user -p db_name &lt; dump.sql</p>
<p>Try again</p>
<p>Your mileage may vary ( do they say kilometerage elsewhere?) so increase the allowed sizes if you have to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=33</wfw:commentRss>
		</item>
		<item>
		<title>Taming the Savage Beast (Forums)</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=32</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=32#comments</comments>
		<pubDate>Wed, 14 Apr 2010 10:00:24 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[forum]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[relative_url_root]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[savage beast]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=32</guid>
		<description><![CDATA[We needed a forum for one of our web projects written in rails and a quick google revealed Savage Beast.  It seemed to fit the bill although needed some css tweeks to co-exist with what we currently have.  However, when clicking on its RSS feed icon it threw an ActionController::Request.relative_url_root method missing error which was [...]]]></description>
			<content:encoded><![CDATA[<p>We needed a forum for one of our web projects written in rails and a quick google revealed <a href="http://www.williambharding.com/blog/rails/savage-beast-23-a-rails-22-23-message-forum-plugin/comment-page-1/#comment-2886">Savage Beast</a>.  It seemed to fit the bill although needed some css tweeks to co-exist with what we currently have.  However, when clicking on its RSS feed icon it threw an ActionController::Request.relative_url_root method missing error which was fixed by creating the class request_error.rb in initializers with the code below:</p>
<p>class ActionController::Request<br />
def relative_url_root<br />
@@relative_url_root ||= case<br />
when @env[&#8221;RAILS_RELATIVE_URL_ROOT&#8221;]<br />
@env[&#8221;RAILS_RELATIVE_URL_ROOT&#8221;]<br />
when server_software == &#8216;apache&#8217;<br />
@env[&#8221;SCRIPT_NAME&#8221;].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/, &#8221;)<br />
else<br />
&#8221;<br />
end<br />
end<br />
end</p>
<p>Based on bug reported here: http://railsforum.com/viewtopic.php?pid=73991#p73991.</p>
<p>It all seems to work fine now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=32</wfw:commentRss>
		</item>
		<item>
		<title>&#8216;Nicer&#8217; URLs for Rails</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=31</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=31#comments</comments>
		<pubDate>Wed, 31 Mar 2010 14:55:57 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[urls]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=31</guid>
		<description><![CDATA[URLs pointing to resources in a Rails app tend to look like www.somesite.com/people/1
Add this to your model:

def to_param
"#{id}-#{title.downcase.gsub(/[^[:alnum:]]/,'-')}".gsub(/-{2,}/,'-')
end
Where title is whatever you want to appear after the id and you will get URLs like
www.somesite.com/people/1-Ian
More info from here
]]></description>
			<content:encoded><![CDATA[<p>URLs pointing to resources in a Rails app tend to look like www.somesite.com/people/1</p>
<p>Add this to your model:<br />
<code><br />
def to_param<br />
"#{id}-#{title.downcase.gsub(/[^[:alnum:]]/,'-')}".gsub(/-{2,}/,'-')<br />
end</code></p>
<p>Where title is whatever you want to appear after the id and you will get URLs like</p>
<p>www.somesite.com/people/1-Ian</p>
<p>More info from <a title="Nicer URLs for rails" href="http://www.seoonrails.com/to_param-for-better-looking-urls.html">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=31</wfw:commentRss>
		</item>
	</channel>
</rss>

