1
2
3
4
def search
  Course.paged_search nil, nil, nil, params[:page]
  # ... add breadcrumb and course_categories
...

Ruby On Search with fulltext, ago-c...

by danielharan, October 07, 2008 14:40

Is this what's going on whe...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
class ReportReader
  def initialize(file_name)
    @lines = File.open(file_name).read.split("\n")
...

Ruby On Parsing non-delimited text

by danielharan, October 06, 2008 13:54

Separate out parsing logic ...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Map fields array and data a...

by danielharan, September 22, 2008 17:07

It's rather odd not to know...

880cbab435f00197613c9cc2065b4f5a Talk
1
biggest_square = [1,4,3,5].inject(0){ |memo, i| [memo, square(i)].max }

Ruby On Conditional Assignment

by danielharan, September 22, 2008 16:34 Star_fullStar_fullStar_fullStar_full

I sent MA a link to your re...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Format Filesize

by danielharan, September 22, 2008 16:18

Check out 'Show source' on ...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
class String
  def uncapitalize
    self.sub(/(^.)/) {|m| m.downcase }
...

Ruby On Camelize

by danielharan, September 22, 2008 16:12 Star_fullStar_fullStar_fullStar_fullStar_full

Rather than pass a flag and...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
class BandMember
  attr_accessor :first, :last, :band
  def initialize(first, last, band)
...

Ruby On Map fields array and data a...

by danielharan, September 22, 2008 16:00 Star_fullStar_fullStar_fullStar_fullStar_full

Wrap that in an object lets...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Conditional Assignment

by danielharan, September 21, 2008 23:53

Maciej, nice catch, that do...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
biggest_square = 0
[1,4,3,5].each do |base|
  (temp = square(base)) > biggest_square && biggest_square = temp
...

Ruby On Conditional Assignment

by danielharan, September 21, 2008 19:38

Tien - I voted 5 for your 2...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
def square(number)
  return number**2
end
...

Ruby On Conditional Assignment

by danielharan, September 21, 2008 16:23 Star_fullStar_fullStar_fullStar_fullStar_full

Tien Dung's last function i...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
for feedback in @feedbacks
  1.upto(20) do |i|
    # unless (answer = feedback.question(i)).nil? # lets you avoid a second call
...

Ruby On Horrible loop

by danielharan, September 17, 2008 14:29

Trying to remove more dupli...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
# For the initial view, there's a better way to keep track of 'count'
# each_with_index is in Enumerable
<ul id="lastfm_update_list">
...

Ruby On Think this needs a loop

by danielharan, September 06, 2008 20:31

What Elij wrote. It avoids ...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
class Report < ActiveRecord::Base
  belongs_to :reportable, :polymorphic => true
  
...

Ruby A shorter way to declare cl...

by danielharan, August 14, 2008 19:47, 1 refactoring, tagged with ruby, rails, constants

I added these so I could re...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Same function repeated but ...

by danielharan, August 08, 2008 19:32

The two last methods don't ...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On How to make instance variab...

by danielharan, July 31, 2008 13:51 Star_fullStar_fullStar_fullStar_full

Persistent storage by addin...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Contoller refactoring

by danielharan, July 30, 2008 12:32

It doesn't have to be an Ac...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
class User < ActiveRecord::Base
  has_many :orders
  has_many :products, :through => :orders
...

Ruby On rails ActiveRecord finder_s...

by danielharan, July 23, 2008 01:42

Here's where I'd see it goi...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
module DashboardHelper
  def activity_message_for(object)
    render :partial => "#{object.class.name.downcase.pluralize}/activity"
...

Ruby On Dashboard

by danielharan, July 22, 2008 12:54

Argh - hopefully now I'm aw...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
4
module DashboardHelper
  def activity_message_for(object)
    render :partial => "#{object.class.name.downcase}/_#{object.class.name.downcase}_activity"
...

Ruby On Dashboard

by danielharan, July 21, 2008 23:01

HTML inside helpers is ugly...

880cbab435f00197613c9cc2065b4f5a Talk