Archive for December 2007

Mephisto Comment Defensio Plugin

We wanted to give Defensio a whirl as we'd read good things about it - up until now we'd used the Akismet feature that comes available with Mephisto as default.

As usual, a quick google took place but no plugins were showing in the usual places (the Mephisto Wiki and Newsgroup).

So, rather than wait for someone else to do it then I went ahead and made it happen!

Read more of this entry

Rails 2.0: validates_acceptance_of can break migrations

If you have a model that uses validates_acceptance_of, you have an observer for that model and you try to run the migration responsible for creating the underlying table then the db:migrate task will fail. The actual error you receive will depend upon your database engine – on MySQL it looks something like this:

Mysql::Error: Table 'database_name.table_name' doesn't exist: SHOW FIELDS FROM `table_name`

The culprit is changeset 8208 which allows the attribute used by validates_acceptance_of to actually exist in the database rather than being virtual. When running the migration to create the underlying table, environment.rb causes the model observer to be loaded which in turn loads the model itself. When the model is loaded validates_acceptance_of tries to determine the column names of the (as yet non-existent) table and, yes you guessed it, blows up!

The good news is that changeset 8377 was submitted 4 days ago to fix this problem. To take advantage of it you’ll either have to freeze Rails to the latest revision or you can simply apply the patch if you’re using something like Piston to manage vendor/rails.

18th December Update: Rails 2.0.2 has now been released and includes the fix for this problem.

Discuss this entry

Halting the filter chain in Rails 2.0

Here’s one that could have you scratching your head in puzzlement for a little while. In Rails 1.2.x you could do something like this in your controller:

class PostsController < ActionController::Base
  before_filter :do_filter
  
  # Controller code
  
  protected
    def do_filter
      # Filter logic goes here
      
      # Halt the filter chain
      false
    end
end

If the filter returned false then processing of the request would stop and you’d see a blank page in your browser.

Not so in Rails 2.0: thanks to changeset 7984 the filter chain is only halted if you render or redirect within your filter. If you really want to get similar behaviour to Rails 1.2.x you could always do this:

def do_filter
  # Filter logic goes here
  
  # Halt the filter chain
  head :bad_request
end

Although you will probably be more popular with your users if you display some kind of friendly error message!

Discuss this entry

RSpec, autotest and Snarl on Windows

Earlier this year I started using RSpec and loved it immediately. Testing is not the most exciting or glamorous part of software development but a behavioural driven approach really appealed to me, as did the much more readable RSpec syntax.

To get me started I bought the RSpec Basics screencast from PeepCode (which has since expanded into a 3 part series). It was a good introduction but, as is often the case in Rails-land, it left me with a case of Mac envy.

The screencast includes a section on using autotest (part of the ZenTest package) and Growl to get instant pop-up notifications when specifications pass or fail. But what about me on my trusty Dell laptop? Where are my shiny notifications?

The good news is that autotest also includes support for Snarl, a Windows alternative to Growl. Hurrah!

Read more of this entry

Out now: Rails 2.0

So Rails 2.0 is finished although, thanks to a last minute fix, it’s version 2.0.1 and not 2.0.0 as you might expect.

Ryan Daigle has posted a big list of changes but even that doesn’t catch all of the features in this new version, there are just too many, so we can expect a slew of new books and screencasts soon. Ryan Bates (why are so many Ryans involved in Rails?) is ahead of the game with his excellent Rails 2.0 Railscasts.

I’ve just updated this site without any difficulties and the new project we’ve just started will be built with Rails 2.0 giving us a great opportunity to try out all the new features.

Now we can look forward to the smokin’ fast Ruby 1.9 that should be out soon and then eagerly await the release of Rails 3.0!

Discuss this entry

To-Done: The new logo and some festive cheer!

After a lot of work our new logo is complete. Thanks to all the efforts of Jon Pink we now have a shiny new logo that works just as well on the web as it does in print.

Read more of this entry

ImageScience and RubyInline on Windows

According to the website ImageScience is a clean and happy Ruby library that generates thumbnails – and kicks the living crap out of RMagick. What it fails to mention is that by the time you’ve jumped through all the hoops necessary to get it running on Windows you’ll be qualified to start working as a professional acrobat.

Read more of this entry

Recent entries

Archives

  1. September 2008
  2. August 2008
  3. July 2008
  4. June 2008
  5. May 2008
  6. April 2008
  7. March 2008
  8. February 2008
  9. January 2008
  10. December 2007
  11. November 2007

Tags

  1. actionview
  2. active messaging
  3. activesupport
  4. actverecord
  5. aes
  6. aggregation
  7. ajax
  8. akismet
  9. amazon
  10. amazon sqs
  11. ami
  12. apache
  13. api
  14. apr
  15. apr-util
  16. async
  17. attachment_fu
  18. attr_accessible
  19. autotest
  20. availability
  21. aws
  22. backgroundrb
  23. beanstalkd
  24. bindings
  25. bj
  26. branding
  27. bug
  28. cache
  29. centos
  30. cloud
  31. clusters
  32. community
  33. company name
  34. compiler
  35. composed_of
  36. consultancy
  37. controller
  38. convert
  39. cookies
  40. css
  41. database
  42. dates
  43. defensio
  44. deployment
  45. design
  46. development
  47. dhtml
  48. docrails
  49. documentation
  50. donations
  51. drdb
  52. ebs
  53. ec2
  54. elastic
  55. elastic block store
  56. encryption
  57. erb
  58. error
  59. events
  60. ezcrypto
  61. fckeditor
  62. feedburner
  63. feeds
  64. filter
  65. flickr
  66. flickr api
  67. flickr_fu
  68. fuse
  69. geekup
  70. geocode
  71. git
  72. github
  73. god
  74. growl
  75. hacker
  76. haml
  77. helper
  78. hmac
  79. holiday
  80. hosting
  81. hpricot
  82. html
  83. identity
  84. imagescience
  85. infiniteftp
  86. init.d
  87. italy
  88. javascript
  89. json
  90. leeds media
  91. linux
  92. logo
  93. mac
  94. markaby
  95. mass-assignment
  96. memcached
  97. mephisto
  98. messaging
  99. migrate
  100. migration
  101. model
  102. mod_rails
  103. mod_ruby
  104. mongrel
  105. mongrel_cluster
  106. monit
  107. monitoring
  108. mq
  109. mysql
  110. neon
  111. new site
  112. nginx
  113. observer
  114. open source
  115. opensolaris
  116. openssl
  117. optimisation
  118. passenger
  119. patch
  120. performance
  121. persistence
  122. persistent storage
  123. persistentfs
  124. php
  125. phusion
  126. plugin
  127. plugins
  128. prototype
  129. queues
  130. rails
  131. rails development
  132. rails patch
  133. rails plugin
  134. rails-doc
  135. refresh
  136. renderer
  137. rich text editor
  138. rmagick
  139. ruby
  140. ruby on rails
  141. rubyinline
  142. rvideo
  143. s3
  144. s3fs. elasticdrive
  145. schema
  146. security
  147. services
  148. snarl
  149. social
  150. solaris
  151. spam filter
  152. sparrow
  153. sql
  154. sql_logging
  155. starling
  156. starter kit
  157. storage
  158. subversion
  159. survey
  160. svn
  161. swig
  162. sysadmin
  163. tamper
  164. templates
  165. the webfellas
  166. time zone
  167. tinymce
  168. to-done
  169. transcoding
  170. tzinfo
  171. uk
  172. uk rails
  173. unsigned
  174. validation
  175. video
  176. view
  177. vmdk
  178. vmware
  179. webfellas
  180. webfellows
  181. wedding
  182. welcome
  183. widgeditor
  184. will_paginate
  185. win32
  186. windows
  187. wysiwyg
  188. xen
  189. xhtml
  190. xvm
  191. youtube
  192. zentest
  193. zfs

Flickr snaps