Archive for July, 2008

search plugin for rails

# USAGE EXAMPLE
# -----------------------------------------------------------
# class PostsController < ApplicationController
#   restful_search do |s|
#     s.model = :foo
#     s.search_param_name = "search" # defaults to 'match'
#     s.columns = [ 'foo.name', 'bar.state', 'baz.comment' ],
#     s.joins = [ :foo => { :bar => :baz } ],
#   end
#
#   def index
#     @posts = restful_search_results
#   end
# end
# -----------------------------------------------------------

Read more »

integer range collection_select form helper

<%= f.collection_select :priority, (1..5), :to_i, :to_i %>

ruby statement modifier local variables

irb(main):001:0> puts foo if foo = "foo"
(irb):1: warning: found = in conditional, should be ==
NameError: undefined local variable or method `foo' for main:Object
from (irb):1

irb(main):002:0> puts foo if(foo = "foo")
(irb):2: warning: found = in conditional, should be ==
foo
=> nil
irb(main):003:0>

sex spam

“Need a mighty wang to bring out your greatest bang?” — sorrapac@margulius.com