Re: [Rails] Re: Reserwavtion system - action book

2012-02-06 Thread Dave Aronson
On Mon, Feb 6, 2012 at 13:53, Dheeraj Kumar wrote: > You should move most conditions to validations. That IMHO is the best way to > refactor this. D'oh, you're right, I totally glossed over that it was in his *controller*! Yeah, this is a canonical time when the Zen master should whack the stud

[Rails] Re: Reserwavtion system - action book

2012-02-06 Thread Rolando Garro
delegating some logic in to models methods might help. On Feb 6, 12:16 pm, regedarek wrote: > Hi, I have in my controller action book, but it looks ugly. How to refactor > its right way? > >  def book > > > > > > > > >     if params[:date].present? && params[:room].present? && current_user > >  

[Rails] Re: Reserwavtion system - action book

2012-02-06 Thread Dheeraj Kumar
You should move most conditions to validations. That IMHO is the best way to refactor this. Dheeraj Kumar On Tuesday 7 February 2012 at 12:19 AM, Dave Aronson wrote: > On Mon, Feb 6, 2012 at 13:16, regedarek (mailto:dariusz.fins...@gmail.com)> wrote: > > > How to refactor its right way? >