July 2007
AAA. →
Rails Captcha Validation with Javascript. →
quickly
Jorgy Porgy. →
Radio marcel.
table.lfmWidget20070630220637 td {margin:0 !important;padding:0 !important;border:0 !important;}table.lfmWidget20070630220637 tr.lfmHead a:hover {background:url(http://panther1.last.fm/widgets/images/en/header/radio/my_regular_blue.png) no-repeat 0 0 !important;}table.lfmWidget20070630220637 tr.lfmEmbed object {float:left;}table.lfmWidget20070630220637 tr.lfmFoot...
June 2007
Tagz.rb
A sneak peak at my upcoming tagz.rb lib.
### test/tagz.rb require ’test/unit’ STDOUT.sync = true $:.unshift ‘lib’ $:.unshift ‘../lib’ $:.unshift ‘.’ require ’tagz’ class TagzTest < Test::Unit::TestCase include Tagz def test_000 #—{{{ expected = ‘<foo ></foo>’ actual = ( foo_ ...
Still rendering now...
Just thought I’d summarize the vareity of responses I got regarding this post. Marcel posted on the rails list with this:
From: “Marcel Molina Jr.” <marcel@NOSPAM.vernix.org> Date: June 28, 2007 10:29:56 PM MDT To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: rendering now! Reply-To: rubyonrails-talk@googlegroups.com On Thu, Jun 28, 2007 at 10:23:09PM...
has_many :bugs, :through => :rails →
the name… what else can i say?
Jaksche ready to talk. →
Render damnit!
I often times find myself wanting to write code in controllers like this:
def login! user = authenticate params[:username], params[:password] user ? true : (( render :file => ‘access/denied’, :use_full_layout => true )) end def post_comment login! generate_content render end
But of course you cannot since a DoubleRender will be thrown. ...
View to a bathroom. →
I want one. →
Web 2.0 Design Zen. →
Logo 2.0. →
Master colour. →
Totally. Completely. Insane. →
Practice. →
Buddhist Spirituality versus Materialism - Essays... →
Rails, database sessions, and...
If you are using this
ActiveRecord::Base::primary_key_prefix_type = :table_name_with_underscore
in config/application.rb. Then the standard
cfp: ~> rake db:sessions:create
won’t work in rails. This is because the session migration generator doesn’t respect the
configured primary key naming convention and because the column the session table uses to store the...
Nonviolence means avoiding not only external physical violence but also internal...
– Martin Luther King, Jr.
Go FXXX yourself. →
Metaprogramming Ruby Insight.
In all the years of Ruby I’ve done this bit of code nonetheless suprised be a little. Read carefully.
class C;end module M o = C.new sc = class « o self end o.instance_eval do FOO = 42 @foo = 42 def foo() FOO end end p C.instance_methods.grep(/foo/i) #=> [] p C.instance_variables.grep(/foo/i) #=> [] p...
Macport Rails/Postgres tidbits. →
Doping reality. →
The World at Night From Space (Powered by Ruby). →
Merb vs Rails.
I think the conventional wisdom is flat wrong. The following tests use database stored sessions to read and store the current time out. Then it simply prints that time and the string ‘42’. All tests ran in production mode. Zero modifications to configs or performance tweaking was done to any setup - they are all stock ‘out of the box’ installs on Darwin 8.9.1...
For Marcel.
Controller.
class IndexController < ApplicationController def index render :text => [Employee, Boss, Company].inspect end def field_example_a # take a copy of the auto-generated employee name field and configure it inline, adding a width property @field = Employee.field(’name’).configured{ width 42 } # fields must have there controller set in order to...
http://codeforpeople.com -> svn
Many of the over 30 libraries available from http://codeforpeople.com are now available via svn at http://rubyforge.org/projects/codeforpeople/.
cfp:~ > svn list svn://rubyforge.org/var/svn/codeforpeople/ alib/ arrayfields/ attributes/ branches/ dirwatch/ dmsp/ dynaload/ envi/ etc/ flow/ fsm/ lockfile/ main/ na_str/ nbfifo/ nmap/ open4/ parseargs/ pervasives/ ...
Strange truth. →
Gem.list!
It seems like all the really cool kids are parading gems. Here are mine. cfp:~ > gem list|egrep ‘^\w’|sed ‘s/ .*$//’|sort POpen4 Platform RubyInline abstract actionmailer actionpack actionwebservice activerecord activesupport alib archive-tar-minitar arrayfields attributes autorequire cgi_multipart_eof_fix daemons ddatime dev-utils dirwatch dmsp ...
Sad news about Frank. →
Inflector.piss_off!
If the pluralization rules in Rails drive you nuts too, and you’ve ever written this in your code:
ActiveRecord::Base::pluralize_table_names = false
Then you probably actually wanted this too:
Inflector.inflections.clear
The first makes table names always singular. The second everything else. It’s only with both that things like associations will also work in the...
Brilliant.
ATTORNEY: Doctor, before you performed the autopsy, did you check for a pulse?
WITNESS: No.
ATTORNEY: Did you check for blood pressure?
WITNESS: No.
ATTORNEY: Did you check for breathing?
WITNESS: No.
ATTORNEY: So, then it is possible that the patient was alive when you began the autopsy?
WITNESS: No.
ATTORNEY: How can you be so sure, Doctor?
WITNESS: Because his brain was sitting on my desk in a jar.
ATTORNEY: I see, but could the patient have still been alive, nevertheless?
WITNESS: Yes, it is possible that he could have been alive and practicing law.
Hooters.
Doug Fales 12.00 PM: i just googled hooters
ara.t.howard 12.00 PM: get any hits?
Doug Fales 12.00 PM: no google returned 0 results.
What makes people happy. →