Forum: Ruby on Rails Bad Smells sing in a rails application

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F09383a4b8725aa99cf892813608de76?d=identicon&s=25 Pedro Del gallego (pedro)
on 2007-06-27 20:17
(Received via mailing list)
Hi all,

  Sometime ago, i read the slides  "when V is for Vexing: Patterns to
DRY Up Your Views" (Bruce Williams  railsconf). They are not online
anymore.  I post one slide in my[1}.. But only the bad smells sign in
the view, and only problem,  not the solution.  here they are

  1. Calling find on a model directly

     <% Sales Sales.find_all_by_region(params[:region]).each .do |t| %><

     % end %>

  2. Calling find on an association

  3. Conditionally inserting content if/else clauses, case statements,
etc

     <% if current_user.admin? %>Admins see this

     <% end %>

  4. Doing a complex inline ma map, sor sort, t, select, etc on a
collection

     <% applications.sort_by{|app| [app.priority, app.creator.name]
}.each do |app|

     <% end %>

  5. Assigning temporar temporary variables

     <% indicator_id = "loading_indicator_#{item.id}" %><%=
link_to_remote("Show Status",:url => item_path(item),

     :loading => "$('#{indicator_id}').show()",

     :complete => "$('#{indicator_id}').hide()",

     ) %>

     <%= image_tag('progress.gif', :id => indicator_id)%>


I would like to ask for new bad smell signs. In the view, in the
controller or in the model.  (and discuss this , specially number 3)

Thanks

--
-------------------------------------
Pedro Del Gallego

Email              :   pedro.delgallego@gmail.com
0900e6a4828bd989f96427082c6c74ca?d=identicon&s=25 Mike Garey (random52k)
on 2007-06-27 21:59
(Received via mailing list)
hmm, I'd like to see the original slides for the answers to these
questions as well.. Too bad they were taken offline..

Mike
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2007-06-28 02:27
(Received via mailing list)
0900e6a4828bd989f96427082c6c74ca?d=identicon&s=25 Mike Garey (random52k)
on 2007-09-25 23:05
(Received via mailing list)
On 6/27/07, Brian Hogan <bphogan@gmail.com> wrote:
> Here you go :)
> http://www.codefluency.com/assets/2007/5/18/VisForVexing.pdf

much appreciated!  Thanks!

Mike
This topic is locked and can not be replied to.