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 [1] : http://theplana.wordpress.com/2007/05/25/bad-smells-sign-in-rails-code -- ------------------------------------- Pedro Del Gallego Email : pedro.delgallego-Re5JQEeQqe9eoWH0uzbU5w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hmm, I''d like to see the original slides for the answers to these questions as well.. Too bad they were taken offline.. Mike On 6/27/07, Pedro Del Gallego <pedro.delgallego-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here you go :) http://www.codefluency.com/assets/2007/5/18/VisForVexing.pdf On 6/27/07, Mike Garey <random52k-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > hmm, I''d like to see the original slides for the answers to these > questions as well.. Too bad they were taken offline.. > > Mike > > On 6/27/07, Pedro Del Gallego <pedro.delgallego-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/27/07, Brian Hogan <bphogan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Here you go :) > http://www.codefluency.com/assets/2007/5/18/VisForVexing.pdfmuch appreciated! Thanks! Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---