Archive for July, 2008
search plugin for rails
July 10th, 2008 •
tags: rails, rails plugins, search
# 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
# -----------------------------------------------------------
integer range collection_select form helper
July 9th, 2008 •
tags: rails, rails views
<%= f.collection_select :priority, (1..5), :to_i, :to_i %>
ruby statement modifier local variables
July 8th, 2008 •
tags: irb, ruby
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
July 2nd, 2008 •
tags: sex spam
“Need a mighty wang to bring out your greatest bang?” — sorrapac@margulius.com