Posted by Rob Anderton on November 2nd, 2008 @ 10:40 – 13 comments
Updated on November 25th, 2008 @ 08:47
Tagged with rails development
For well over a year now attachment_fu has been my plugin of choice for adding file uploads to our Rails applications, but recently my fellow WebFellas have been raving about Paperclip from the clever guys at thoughtbot. As I’ve just started yet another new project I figured it was time to take Paperclip for a spin.
Read more of this entry
Posted by Rob Anderton on September 13th, 2008 @ 18:15 – 0 comments
Updated on October 30th, 2008 @ 08:37
Tagged with rails development
I’ve always enjoyed a kind of love/hate relationship with JavaScript, something which I think stems from my early exposure to using it on Microsoft platforms in the late 90’s, using half-baked debuggers, inconsistent browsers and a huge degree of trial and error. It’s not that I can’t write clever things in JavaScript, just that it’s not my most favourite job: if I can delegate to someone else I usually will!
Last week I was left with no choice but to roll up my sleeves and get coding: I was putting together a financial trading application prototype for one of our new clients and wanted to use JavaScript and JSON to periodically update pricing information.
Read more of this entry
Posted by Rob Anderton on August 24th, 2008 @ 11:11 – 4 comments
Updated on August 27th, 2008 @ 10:54
Tagged with rails development
Did you know ActiveRecord includes support for aggregations? If you did, have you ever used them? Despite being part of Rails from the start composed_of tends to lurk in the shadows while newer features like named_scope steal the limelight. It’s time to give composed_of some love again!
Read more of this entry
Posted by Rob Anderton on July 20th, 2008 @ 11:30 – 1 comment
Updated on July 20th, 2008 @ 11:32
Tagged with rails development
Last week Jeremy McAnally talked about the continuing decline in Rails blogging. Like many Rails developers I’ve learned a lot from blogs over the last couple of years: in the early days it was pretty much the only way to find out about how Rails worked as the official documentation was poor to say the least.
In my opinion though, the future for Rails documentation is not as bleak as Jeremy suggests. Less blogging could simply indicate a move towards better quality postings: I’d rather have a choice from a handful of really well written blogs than the hundreds of “OMG!!! Look how awesome Rails is…” style posts that I used to have to trawl through – less hype and more substance is definitely better.
The official documentation is, at last, being improved too: as announced in May there is now a docrails branch on Github and it has already seen a huge number of changes committed.
While I don’t particularly miss coding in PHP it came as quite a shock when I made the move to Rails to find that there wasn’t anything that came close to its documentation. Not only is there a language reference, full documentation for the standard extensions (and with the crazy lack of naming conventions or namespaces in PHP this is really useful!) there is also the invaluable comments section where other PHP developers can contribute extra documentation to each and every part of the language.
This is what Rails has needed for a long time. The great news is that thanks to the hard work of the guys at Nodeta it has finally arrived: behold Rails-doc! The site reached version 2.0 last week and now it has pretty much everything you could ask for:
- Full documentation of the Rails API including different versions of the API.
- User comments.
- Easy to use search, as well as a Firefox search bar extension.
- A simple, clear user interface that is far better to navigate than the official API documentation.
Now, perhaps more than ever before, we as a community can get involved to improve Rails documentation: we can of course continue with our blogs, but we can also submit patches to docrails and post comments to Rails-doc. These things combined should ensure that we don’t reach the point where, to quote Jeremy, Rails becomes an esoteric project doomed to eventual abandonment because everyone has to shell out $40 for a book to learn how to use it.
Discuss this entry
Posted by Chris Anderton on June 12th, 2008 @ 09:00 – 0 comments
Updated on June 12th, 2008 @ 08:59
Tagged with rails development
As I previously posted Amazon have announced that persistent storage is on it's way for EC2. Sadly the public launch date has not yet been disclosed - it's "coming later in the year". In the meantime this leaves the question of what to do when you need data to persist?
There are a number of options, especially when you start to consider scalability and fault tolerance. I won't dare claim I've considered all the options out there - I've simply started to look at what the immediate options are for persistent storage.
Without further ado, then, on to the technology. I've found a number of choices - rather than this being a 'how to' then it is more about the solutions I have found so far and that are on my list for consideration. Hopefully, if one of the options fits my needs then I will provide a guide at a later date!
Read more of this entry
Posted by Rob Anderton on June 9th, 2008 @ 18:00 – 22 comments
Updated on November 27th, 2008 @ 12:27
Tagged with rails development
Rails 2.1 has just been out a week and so far something that seems to have passed most people by is that it now includes much better caching capabilities, including built-in support for memcached.
Last week I reached the point with an application where I needed to cache some models in memory to get a performance boost and decided to check out the current status of plugins like cache_fu and CachedModel to make sure they’d work with Rails 2.1. It was completely by accident that I stumbled across this innocent looking commit by DHH from start of this year and realised that Rails already had everything I needed!
Read more of this entry
Posted by Rob Anderton on June 2nd, 2008 @ 15:23 – 3 comments
Updated on June 10th, 2008 @ 12:12
Tagged with rails development
Ok, so I’m starting a new Rails application, I’ve spent some time refining my database, I’ve considered storage requirements and performance when choosing the data types for my fields and now I’m ready to create some migrations to implement my design.
And then I’m reminded that, lovely though Rails migrations are, there are two things that really bug me about them: they create signed primary keys and they don’t allow me to easily create unsigned integer columns.
It’s been discussed before, dismissed as an ‘uncommon requirement’ (probably because MySQL is, as far as I know, the only database that uses unsigned integers) and, as far as I can tell, not a lot more has happened. So, while sat out in the garden, enjoying a sunny Saturday afternoon, I grabbed edge Rails from GitHub and decided I’d see if I could do something about it (how’s that for geekyness?!)
Read more of this entry
Posted by Chris Anderton on May 21st, 2008 @ 10:37 – 0 comments
Updated on June 10th, 2008 @ 12:13
Tagged with rails development
Following on from Rob's Rails plugin round-up a few months back then another plugin has repeatedly found it's way into our projects - sql_logging.
Read more of this entry
Posted by Rob Anderton on April 21st, 2008 @ 10:48 – 1 comment
Updated on June 10th, 2008 @ 12:13
Tagged with rails development
The default Rails behaviour for highlighting form fields with errors is to wrap them in a div, so:
<div>
<%= f.label(:email) %>
<%= f.text_field(:email, :size => '30') %>
</div>
Becomes:
<div>
<div class="fieldWithErrors"><label for="user_email">Email</label></div>
<div class="fieldWithErrors"><input id="user_email" name="user[email]" size="30" type="text" value="" /></div>
</div>
This is great when knocking together a quick prototype but as your site evolves you’ll probably want to customise it. This can be done very easily by using ActionView::Base.field_error_proc, assign a Proc to it either in your environment.rb or, if you’re a modern thinker, in an initializer and you’re good to go.
Read more of this entry
Posted by Rob Anderton on April 8th, 2008 @ 18:55 – 9 comments
Updated on June 10th, 2008 @ 12:13
Tagged with rails development
So today I found myself in need of a WYSIWYG editor for the admin pages of the site I’m currently working on. I’ve used FCKEditor and Scott Rutherford’s Rails plugin before and Chris has recently been using TinyMCE for a few of our other projects but both of them seemed too heavy, especially when the project requirements only stated a need to apply simple formatting like bold, italic and headings.
Read more of this entry