A first attempt to denine a self method:
In my ProjectItem model I have a field 'book'
In that model there is this method:
def self.find_books find( :all, :select => "DISTINCT(book)", :order => "book ASC" ) end
In another controller:
@books = ProjectItem.find_books
Then in a _books.html.erb partial:
<% if @books%> <% @books.each do |name| %> <%= link_to ( #{name.book}, {:controller => "projects", :action => "show","} %> <% end %> <% end %>
I am expecting that the selection creates an array where where @books[0][:name] is the name of a book.
Not so, evidently---or my Query is not correct?