#more elegante way? 
sector = Sector.create(:name => name) unless sector = Sector.find_by_name(sector)

Ruby more elegant way

by RoadHouse, December 01, 2011 09:52, 5 refactorings, tagged with ruby, activerecord, rails3

no ideas about it, rails 3....

70089e712ed13abb99bec89bd5bfba77 Talk
#MM-YYYY
"2011-10".split("-").reverse.join("/") => "10/2011"

Ruby parsing date

by RoadHouse, November 24, 2011 12:40, 3 refactorings, tagged with ruby, date

anyone has the better solut...

70089e712ed13abb99bec89bd5bfba77 Talk
def is_pos_activation?
    if session[:pos_activation]
      block_given? ? yield : true
...

Ruby better way?

by RoadHouse, July 21, 2010 18:48, 5 refactorings, tagged with ruby, block, if

i like this code, but exist...

70089e712ed13abb99bec89bd5bfba77 Talk
if current_user
      @var = current_user.search_terms.build
    else
...

Ruby if else more elegant

by RoadHouse, March 25, 2010 15:33, 5 refactorings, tagged with ruby, if

is a better way to do this?

70089e712ed13abb99bec89bd5bfba77 Talk
def self.all_leaves
    leaves = []
    Category.roots.each do |category|
...

Ruby array iteration

by RoadHouse, July 23, 2009 23:12, 5 refactorings, tagged with rails, ruby, array

i dont find a better way to...

70089e712ed13abb99bec89bd5bfba77 Talk