>> %w(Pending Processing Executed Canceled).each_with_index.map {|v, i| i}
=> [0, 1, 2, 3]
def sort
if params[:fact_id]
@fact = Fact.find_by_id(params[:fact_id]) || Fact.new
...
Ruby Ugly IF, ELSE
Trying to make this a lot c...
def show
if params[:course_id] && permitted_to?(:browse, :videos)
...
Ruby Need to DRY this if-else up
by fnjord.myopenid.com,
March 25, 2009 17:43,
3 refactorings, tagged with rails, ruby, dry, conditions, if else
I thought of creating a bef...
public class MvNetDB
{
protected mvAccount _account = null;
...
C# Help me with ineritance or ...
I'm new to C# and working o...
class PeopleController < ApplicationController ...
Ruby Re-use code for new and cre...
Hello,
I have a 'people'...
def planned_percent_complete
if self.planned_complete_in_dollars != nil
(( self.planned_complete_in_dollars.to_f / self.task.budget.to_f ) * 100).round(2)
...
Ruby Same methods, different Act...
I know there has to be a "r...
Using it :in validates_incl...