Posts tagged with "rubyonrails"

What the heck is ActiveRecord?

Gregg Pollack of Rails Envy has put together a great presentation about Active Record and object mapping.  The synopsis of the screencast is

It takes about 25 minutes to go through the video so if you have some spare time during a lunchbreak grab some coffee, a sub and educate yourself.  Enjoy.

2007-08-17 by Jonathan Clarke - Comments: 0 | New Comment

Why Choose Ruby? Let's discuss

I have just completed reading Michel Barbosa's thesis on the delivery of the key adoption factors and demographic characteristics of companies already using Ruby on Rails, available here.

For a Ruby on Rails developer it really is an intruiging read and also gives me a few ideas on how to convert some companies I know away from their PHP and Java based frameworks. Included are quite a few case studies on why a particular company has chosen RoR as their framework of choice. 

The main reason for adoption seem to be as as follows:

  1. Open Source
  2. MVC framework
  3. Out-of-the-box testing facilities
  4. Ruby programming language (elegant, speed of programming)
  5. Convention over configuration
  6. DRY
  7. Incorporation of latest trends (AJAX and RESTful interfaces)
  8. Active Record ORM layer
  9. Migrations
  10. 3 different development environments
  11. Maintainability
  12. Agile development
  13. Joy in development

There are quite a few more delightful statistics which are very nice to look at in the thesis which I am sure every person trying to convince their CEO to adopt Rails should find helpfull.  Great work Michel, keep it up. 

2007-07-09 by Jonathan Clarke - Comments: 0 | New Comment

Globalize on Rails needs a quick patch…

Throughout my Rails journey I have come across a number of problems with various plugins. The globalize plugin is one which can completely localize an application through a database and some simple syntax. Chinese & English sites here I come…Anyhow during the install of Globalize for Rails 1.2 I came upon the following error and here is it’s solution if anyone needs it.

This has been tested on a fresh Globalize install on Debian, Rails 1.1, MySQL –version:
“mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (x86_64) using readline 5.2″

Error
================
** Execute globalize:create_tables rake aborted! Mysql::Error: #42000Identifier name ‘index_globalize_translations_on_table_name_and_item_id_and_language_id’ is too long: CREATE INDEX index_globalize_translations_on_table_name_and_item_id_and_language_id ON globalize_translations (table_name, item_id, language_id)
================

Cause
================
On Globalize Migration, line 32, an index to globalize_translations is created. However, this fails due to the index name being added as: add_index :globalize_translations, [ :table_name, :item_id, :language_id ]

… which in turn tries to create an index name of: index_globalize_translations_on_table_name_and_item_id_and_language_id

This is 70 characters, which exceeds the index identifier limit of 64 characters: http://dev.mysql.com/doc/refman/5.1/en/identifiers.html
================

Solution
================
One solution is to rename the index name, in: globalize/generators/globalize/templates/migration.rb (migration.rb.gz:32 && tiny_migration.rb.gz:31)
…to:
add_index :globalize_translations, [ :table_name, :item_id, :language_id ], :name => ‘glb_trns_idx’
================

If this is double dutch to you then pay no heed, it will definitely help out some poor other misfortunate person and save them some much valuable time in the future.

2007-04-02 by Jonathan Clarke - Comments: 1 | New Comment

Mobile Websites with Ruby on Rails 2.0

So seeing as I have had a bit of free time over the past day (30 minutes), in between my own job here in Dublin and helping my parents out in their bar over the holidays I've also been looking at creating a nice and minimalistic mobile site for beilabs.com.  It's not up and running yet but hopefully it will be shortly. 

As I won a nice new IPOD Touch last month I decided to put the mobile safari browser to some use and check to see how well rails looks on it.  Apparently there is a mac application designed for exactly this purpose called iPhoney but I prefer to use the real thing.  

Now there are quite a few ways that creating a mobile rails site can be accomplished however I went for the nice easy way and decided to just find out the users mime type. 


The Juicy Bits

First we add a helper method to application_helper.rb

app/helpers/application_helper.rb
# Request from an iPhone or iPod touch? (Mobile Safari user agent)
def iphone_user_agent?
request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(Mobile/.+Safari)/]

This is vital to ensure future compatibility with apple hardware.  Bear in mind that this is a short term solution as there will be plenty of nice browsers on mobiles in the future such as Opera to name one.

So next in our view we can redirect them to an optimized website specifically for the iphone/itouch safari mobile browser

<% if iphone_user_agent? # Show message for iPhone users -%>
<div class="message">
<p>Using an iPhone? <a href="http://iphone.beilabs.com/">Use the optimized version</a>.</p>
</div>
<% end -%>end

Back to Reality

http://mobile.beilabs.com is not even up yet, it's barely a figment of my drunken imagination but it will be soon I hope.  Anyhow, I'm off to watch Kill Bill, I hope that gave some people a bit of an idea about how to make a rails mobile website.  Easy eh?  Yeah, it always looks that way.

2007-12-27 by Jonathan Clarke - Comments: 0 | New Comment

So what does everyone think of Ruby on Rails?

A new post on the Google Ruby.ie group pushed me to investigate a niggling feeling that I've been having a little bit further.  With Google having recently released Google Insights for Search, which allows you to compare search volume patterns across specific regions, categories, and time frames I set off on a voyage of discovery and understanding.   In no time I pulled the result sets from this pretty nifty tool and here they all are for you to see.  

Irish Results

Ruby on Rails Irish Trends

USA Results

Ruby on Rails USA Trends

Worldwide results

Ruby on Rails Worldwide Trends

I was very fortunate to land a full time job with a great company coding in the language I love so much, however, the rest of the island is not so lucky as from the results below for Ireland it would seem that most interest is completely restricted to Dublin.  Looking at the American figures, it is only natural that it has hit it's stride within California however Utah being the dominant player for Rails queries knocked me for six, I never expected it.  I was not surprised to see India hitting the high points of the trends, new technologies are approached as a new tool in the arsenal of outsourced workers, if it saves time and money then it's studied and implemented. 

Another fact to note is the appearance of the growth of Ruby on Rails within Eastern Europe.  I have no doubt in my mind that is where the software revolution is happening within Europe.  Last February I was present at Euruko, a ruby centric conference, in Prague.  It was quite mind boggling to see Eastern Europeans enthusiasm shining through with their talk of new start-ups, technology and love of the technology.  It's definitely a place to watch out for in the future for outsourcing. 

The worldwide opinion of rails was largely positive from 2004 - mid 2007, however it definitely seems to be on the wane going into 2008.  Has the community hit a stumbling block, is it penetrating the enterprise or has such bad publicity of the rumour that "Rails doesn't Scale" reached the ears of the enterprise?   Has the secret out that Rails is not the be-all and end-all of web development?  Much of the innovation that wowed the world initially seems to be creeping into the code-bases of other languages, granted that not all credit should go directly from rails but to older frameworks.  It's a tough question to answer however I am looking forward to what Ruby and by de-facto Ruby on Rails evolve into in the coming years.  It is my favourite framework after all.  I'll leave it to the rest of the bloggers to do a comparison between PHP, J2EE and .NET in Ireland. 

This is by no means conclusive, it simply represents the interest of the term over time.  There are a number of arguments about if these numbers are actually acurate and if so to what degree.  The numbers on the graph reflect how many searches have been done for a particular term, relative to the total number of searches done on Google over time. They don't represent absolute search volume numbers, because the data is normalized and presented on a scale from 0-100; each point on the graph is divided by the highest point, or 100. The numbers next to the search terms above the graph are summaries, or totals.

By the way, anyone who is interested in a full time Ruby job within a financial company, apply here.  The jobs are out there, you just need to know where to look.

2008-08-15 by Jonathan Clarke - Comments: 0 | New Comment

Ruby on Rails Oceania

Anyone interested in ruby and in Sydney, should seriously get along to the monthly RORO meetup.  I went along last Wednesday night and enjoyed 4 pretty informative talks, some nice food, good beer and an amazing mix of people working in different industries. 

Thanks to all for the very warm welcome, not thankful for the larger hangover, I blame that on not having eaten any food previously before sampling the fine beers Australia has to offer.  Oh and I found out about a cool hackfest known as Webjam which is happening in the coming weeks, hope to see you there.

2008-09-12 by Jonathan Clarke - Comments: 0 | New Comment