1
2
3
4
  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 block, ruby, if

i like this code, but exist...

70089e712ed13abb99bec89bd5bfba77 Talk
1
2
3
4
    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
1
2
3
4
  def self.all_leaves
    leaves = []
    Category.roots.each do |category|
...

Ruby array iteration

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

i dont find a better way to...

70089e712ed13abb99bec89bd5bfba77 Talk