Geoffrey Grosenbach looks at how to use memcached, a fast in-memory caching daemon, from Ruby and Rails to speed up common repeated data operations, including ActiveRecord lookups. He also includes a useful install script and patch for Mac OS X users to make memcached fly on that platform. He also demonstrates the use of the cached_model gem to significantly speed up database reads from Rails applications. Read More
AutoAdmin is a new plugin for Rails that automatically generates an administration interface for your models. It’s heavily inspired by Django, where meta-data relating to the administration interface is placed directly into the models. This goes directly against David Heinemeier Hansson’s preferences, but might be perfect for your own systems.
Example model code: Read More
class Customer < ActiveRecord::Base
belongs_to :store
has_many :payments, :order => ‘payment_date DESC’
def name; first_name + ‘ ‘ + last_name; end
sort_by :last_name
search_by :first_name, :last_name
filter_by :active, :store
default_filter :active => true
list_columns :store, :first_name, :last_name
admin_fieldset do |b|
b.text_field :first_name
b.text_field :last_name
b.select :store
end
admin_child_table ‘Payments’, :payments do |b|
b.static_text :payment_date
b.static_text :amount
end
end
Scruffy is a new graphing toolkit for Ruby developed by Brasten Sager. It’s highly customizable and powerful. You can change the backgrounds, mix different types of graph together, change the graphics used for the points, change the line types, etc. You can also render to different types of output. Brasten presents some code examples at his blog. For demonstration, some is repeated below:
graph = Scruffy::Graph.new
graph.title = "Comparative Agent Performance"
graph.value_formatter = Scruffy::Formatters::Percentage.new(:precision => 0)
graph.add :stacked do |stacked|
stacked.add :bar, ‘Jack’, [30, 60, 49, 29, 100, 120]
stacked.add :bar, ‘Jill’, [120, 240, 0, 100, 140, 20]
stacked.add :bar, ‘Hill’, [10, 10, 90, 20, 40, 10]
end
graph.point_markers = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
graph.render(:width => 800, :as => ‘JPG’)
(Thanks to Brasten for fixing my sloppy cut and paste job. Read More
Heat maps allow you to see where people are clicking on your Web page(s) and while some pay-for, professional systems offer this feature, David Pardo has put together a guide, including Ruby and JavaScript source, of how to create your own from scratch! Read More
ar_mailer is a system that automatically queues outgoing mails from Rails applications (using ActionMailer) by placing them into a special database table, to then be handled by a separate process, ar_sendmail. This could be particularly ideal for systems with mass mailing applications or simply as a method to speed up certain requests in your Rails applications since only a single database write is required rather than waiting for an e-mail to finish sending. Read More
Rick Olson and Josh Goebel have teamed up to produce Beast, a lightweight but well styled forum. Rails has sorely been lacking a good, well styled, open source forum, but Beast is great. Check out the demonstration forum or go get the code for yourself. Read More
If RADRails doesn’t capture your fancy and you’d rather use regular Eclipse as your Ruby IDE, Tabrez Iqbal has a great walkthrough of setting up Eclipse and using it to develop Ruby applications along with lots of screenshots and useful information. Read More
Juixe presents a list of 13 top Ruby on Rails presentations that you can watch, listen to, or download. Topics cover pure Rails, Rails vs Python comparisons, software design keynotes, Flex, and Java.
Note: This is one of the first entries in the “Write a post about Ruby and win $100” contest that Ruby Inside is running this week. If you want to get in on the action, learn more, and write an interesting Ruby post on your weblog before this Sunday! Read More
Josh Susser explains exactly how Rails’ dynamic finders work (things like User.find_by_name and User.find_all_by_city). It’s a good introduction to some of the simpler abstractions taking place under the hood in Rails, and is an ideal guide if you’re thinking of creating similar abstractions of your own. Read More
Authors and technical reviewers required!
Technical publishers Apress are busy working on what be the biggest line of Ruby and Rails books in the industry, and now that I’ve figured out how to self publish a book, my book Beginning Ruby is set to be one of the first to hit the shelves along with Beginning Ruby on Rails, Pro Ruby, and Beginning Ruby on Rails E-Commerce all by other great developers (Jarkko Laine is working on the e-commerce book, for instance).
Keir Thomas, an editor at Apress and responsible for the open-source web development line, has told me they’re looking for even more developers to get involved with their Ruby and Rails related offerings. Read More
Evan Henshaw-Plath (more commonly known as rabble) is in the process of writing a book for O’Reilly about testing and debugging Ruby on Rails applications, and has just launched a companion blog, Testing Rails. The subject of the blog is exactly what the title says, and rabble hopes to post at least one in-depth tutorial relating to Rails and testing each week. The first is Building Tests from Logs – Test Driven Debugging. Read More
It’s Ruby Inside’s first competition! Ruby Inside is desperate for amazing Ruby and Rails content to link to, so let’s get the ball rolling..
Ruby Inside is offering a top prize of $100 for blogging about Ruby or Rails this week. The winner will be drawn at random from all Ruby related blog posts linked to in a comment or trackback made to this very post only. To win, your post must demonstrate something interesting or new about Ruby that Ruby Inside users could find interesting. Any tutorial, insight, cool code example, etc, is eligible.
A single second prize of $15 is offered for just linking to this contest on your blog or forum. Read More
Feedalizer is a Ruby library that lets you easily scrape Web pages and convert them into RSS feeds. Some demo code that generates a feed: Read More
require “feedalizer”
require “time”
url = “http://sydsvenskan.se/serier/nemi/article101047.ece?context=serie”
feedalize(url) do
feed.title = “Nemi”
feed.about = “…”
feed.description = “Daily Nemi strip scraped from Sydsvenskan”
scrape_items(“option”) do |rss_item, html_element|
rss_item.link = html_element.attributes["value"]
rss_item.date = Time.parse(html_element.innerHTML)
rss_item.title = rss_item.date.strftime(“%Y-%m-%d”)
# This grabs the page for a particular strip and extracts the relevant img element
rss_item.description = grab_page(rss_item.link).search(“//img[@width=748]“)
end
output!
end
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
:default => "%m/%d/%Y",
:date_time12 => "%m/%d/%Y %I:%M%p",
:date_time24 => "%m/%d/%Y %H:%M"
)
Richard Leonard demonstrates how to use the date formats that come with Rails, as well as how to override or add some of your own directly into Rails’ helpers on the fly. Read More
Scott Broson has reviewed four different Ruby debuggers and works out which is the best. Read More