Bad Smells sing in a rails application

Hi all,

Sometime ago, i read the slides “when V is for Vexing: Patterns to
DRY Up Your Views” (Bruce W. 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,

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

    <% end %>

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

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

    <% end %>

  5. Assigning temporar temporary variables

    <% indicator_id = “loading_indicator_#{}” %><%=
    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)


[1] :

Pedro Del G.

Email : [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs