has_browser looks like it makes simple browsing queries easier. It also works chained together with Rails 2.1’s named_scope functionality.
Note to self: alias_method_chain doesn’t work with ActiveRecord attributes.
Rails Search Benchmarks comparing Ferret, Solr, and Ultrasphinx.
Extend String to use ActionView’s Text Helpers. I may have to add this to my standard bag of tricks. Wish it was in core. Fortunately, in Edge Rails, the helpers are now accessible by module. Nice!
Promise and Peril for Alternative Ruby Impls. JRuby’s Charles Nutter takes a look at the state of the alternative Ruby implementations and the challenges they face. I hadn’t heard of MacRuby before—sounds like it will be a great way to write Mac OS X apps. MagLev (Ruby with Smalltalk VM technology) also sounds interesting (interview) but I imagine it will cost booku bucks.
Here’s a few interesting Ruby links I’ve been keeping open in tabs and minimized browser windows.
- Faker looks like a great addition to a database fuzz script for more realistic data.
- Nanoc is a “baked not fried” CMS (it generates static pages) written in Ruby. It looks very cool. I’m thinking about re-doing my personal web site using it.
- I’m finally trying out make_resourceful. Pretty useful. The problem with plugins like this is that they save you a ton of time if you take the time to learn to use it, but for any individual controller, I could probably write it faster by hand. But I think the investment will pay off. There are a few places where I need more control than make_resourceful’s default assumptions—but it’s really easy to code those actions by hand.
- Shoulda adds some very nice macros for testing a bunch of stuff with models and controllers. I’m not using the contexts and should syntax yet, though.
- Having trouble with the new Rails 1.2.6/2.0 cross site request forgery protection and
ActionController::InvalidAuthenticityTokenerrors? It might be due to restful_authentication. Check out this ticket. The solution is to remove the
UsersController#create. The newest version of the plugin doesn’t have this problem any more.
- Django automaticaly escapes HTML. I think this is a decision that every modern web framework should adopt. You hardly ever want user-submitted content to be displayed with HTML intact, and when you do, you need to pay special attention to which elements will be allowed. Some potential solutions for Rails: use Erubis instead of Erb, acts_as_sanitized, the whitelist plugin which has been merged into Rails 2.0 (promising, but last time I used it I found it required quasi-valid HTML, and thus broke under real-world conditions) .
- Blueprint CSS framework is rockin’.
- Friendlier, customizable attachment_fu error messages.
- That checkbox needs a label. Don’t forget to add labels to check box and radio button fields!
So many links from Ara T. Howard that he deserves his own section:
- AM/PM datetime_select replacement
- Sane transactions for Rails
- Setting defaults with ActiveRecord
- Rails – ActiveRecord validations are fatally flawed
What’s all the secret glue behind most of these links? Shhh. Don’t tell anyone I told you.
- Kristian Köhntopp writes about common MySQL performance problems with Rails. He shows some ignorance of Rails, but most of the issues he raises are important. Every database has its gotchas so at some level, database abstractions like ActiveRecord fall over. Fortunately, as long as you’re aware of the issues Kristian raises, you can work around most of them. Calling attention to Rails’ default of using large varchars and
select *by default is especially important.
- Patrick Reagan’s caches_constants plugin looks like a nice implementation of the common Java pattern of type-safe enumerations backed by the database. That means you can use constants in your code and foreign keys in your database to refer to a set of objects. With Patrick’s plug in, these objects are only queried for once when your Rails app starts up.
- I thought the Ruby documentation for Object#instance_variable_set was pretty funny:
Sets the instance variable names by symbol to object, thereby frustrating the efforts of the class‘s author to attempt to provide proper encapsulation. The variable did not have to exist prior to this call.
- If you’re wondering why you can’t get Bugzilla working with Apache 2.2, the answer is that they’ve changed the default permissions. Raditha Dissanayake has information on how to fix this.
- Finding the intersection of two date ranges is annoying, but it has a simple solution if you’re clever about it. Ryan Farley visualizes the problem, but “Dithermaster” realized it’s a lot simpler to find out if two ranges don’t overlap, and negate that. His solution is nicely usable in SQL.
- During Ostrava on Rails I had the pleasure of meeting (and drinking a pivo or three) with Robert Cigán, developer for Czech Rails development shop Skvělý.CZ. He sent in a link to Skvělý.CZ’s latest application, sMoney.eu an easy to use personal accounting app for EU users. Check it out if you’re in the EU!