Or just make your own named scope with the order parameter you want. Or if it is a one off type of thing just add a regular find :all, :order.
But from the look of your example code there, I have to wonder why you're redoing your find in the view. Take out the with="&Product.all" in your repeat. Your context should be the @products you already found in the controller. If for whatever reason that's not your context, change the repeat to with="&@products". On Mar 18, 4:08 pm, Tiago Franco <[email protected]> wrote: > Hi, > > I mean something like this:http://snippets.dzone.com/posts/show/4387 > > :) > > TF > On Mar 18, 9:25 pm, Hobo_Fan <[email protected]> wrote: > > > Thank you, Tiago. > > > Do you mean to do something like this? Some of the stuff I put into > > database at later time was still out of alphabetic order on my index > > page. > > > class Product < ActiveRecord::Base > > > hobo_model # Don't put anything above this > > > fields do > > product_name :string, :name => true, :order => "product_name" > > > On Mar 18, 12:14 pm, Tiago Franco <[email protected]> wrote: > > > > Hi, > > > > Probably the best way is to override the "find" method in your Product > > > model. > > > > TF > > > > On Mar 18, 4:27 pm, Hobo_Fan <[email protected]> wrote: > > > > > Hi All, > > > > > I am trying to sort all my product listing in alphabetize order on my > > > > product index page. I did add order by product_name in my product > > > > controller; however, it did not take it. Is it possible to add order > > > > by in <repeat with="&Product.all"> > > > > > ProductsController.rb: > > > > > class ProductsController < ApplicationController > > > > > hobo_model_controller > > > > > auto_actions :all, :except => {:show, :index} > > > > > def index > > > > �...@products = Product.find(:all, :order => "product_name") > > > > > Here is what is in my product index.dryml page. > > > > <page title="Products"> > > > > <table> > > > > <tr bgcolor="#DAA520"> > > > > <th>Product Name</th> > > > > <th>Version</th> > > > > <th>Operating System</th> > > > > <th>Quantity</th> > > > > <th>Order Date</th> > > > > <th>Upgrade</th> > > > > <th># of Clients</th> > > > > <th># of Licenses Assigned</th> > > > > </tr> > > > > <repeat with="&Product.all"> > > > > <tr> > > > > <td><a><view:product_name /></a></td> > > > > <td><view:engine_version /></td> > > > > <td><view:platform /></td> > > > > <td><view:qty /></td> > > > > <td><view:order_date /></td> > > > > <td><view:upgrade /></td> > > > > <td><count:clients/></td> > > > > <td><count:licenses/></td> > > > > </tr> > > > > </repeat> > > > > </table> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
