thanks for the tips Phlip, specially the How easily can you test
your SQL-like statement? metric.
Phlip wrote:
Nothing that looks at all like SQL should go into a controller, view,
or helper.
Helpers are a gray area. In software design, there is the concept of
breaking up low-level coupling
On 06/05/2009, at 12:37 PM, Phlip phlip2...@gmail.com wrote:
Phlip wrote:
Nothing that looks at all like SQL should go into a controller,
view,
or helper.
Things that look like SQL include any kind of query more
elaborate than a
simple accessor call.
I just read _all_ of
PP Junty rails-mailing-l...@andreas-s.net wrote:
Nothing that looks at all like SQL should go into a controller, view,
or helper.
it really came as a surprise to me as Rails itself seems to go against
such practice by its AR 'conditions' option, which most of the times
contains
SQL code.
Like all good programming rules of thumb there are interesting exceptions.
Complicated unions and intersections, especially where the from clause might
be a dynamic select, such as might be needed for a report can be very
difficult to do without resorting to passing the sql directly to the
Charles Johnson wrote:
Like all good programming rules of thumb there are interesting
exceptions.
this is exactly where things get confused, because code like the
example i provided seems to be the norm, not the exception.
--
Posted via http://www.ruby-forum.com/.
On May 5, 11:52 pm, PP Junty rails-mailing-l...@andreas-s.net wrote:
Charles Johnson wrote:
Like all good programming rules of thumb there are interesting
exceptions.
this is exactly where things get confused, because code like the
example i provided seems to be the norm, not the
The code you posted is fine, it just depends where you put it:
that is why i named the thread no sql in the controller. :)
- in a view: super bad
- in the controller: not so good
i agree, i just didn't see any mention to this guideline in
the books i consulted or in the AR source code
PP Junty wrote:
hello. i just checked Chad Fowler's post 20 Rails Development No-No's
and
one guideline caught my attention. it says:
Nothing that looks at all like SQL should go into a controller, view,
or helper.
Things that look like SQL include any kind of query more elaborate than a
Phlip wrote:
Nothing that looks at all like SQL should go into a controller, view,
or helper.
Things that look like SQL include any kind of query more elaborate than a
simple accessor call.
I just read _all_ of Fowler's statement.
Helpers are a gray area. In software design, there is
9 matches
Mail list logo