search for: find_by_first_name

Displaying 3 results from an estimated 3 matches for "find_by_first_name".

2006 Mar 30
2
acts_as_ordered plugin
...sted. Install: script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_ordered Usage: class Person < ActiveRecord::Base acts_as_ordered :order => ''first_name'' end Say you have people with first names of Adam, Jonathan and Robert: p = Person.find_by_first_name(''Jonathan'') p.next # Robert p.previous # Adam p.previous.previous # Adam (does not wrap around to end) p.next.next # Robert (does not wrap around to start) If you want the next and previous methods to wrap around the ends, use: acts_as_...
2006 Jan 19
0
Help with nested HABTM relationship
...key => "prospect_list_id" 22 has_and_belongs_to_many :accounts, 23 :join_table => "accounts_contacts", 24 :foreign_key => "contact_id", 25 :association_foreign_key => "account_id" 26 end 27 28 me = Contact.find_by_first_name("Siros") 29 print me.last_name 30 me.accounts.each do |company| 31 puts company.name 32 end 33 # => "JohnsonIBM" 34 35 36 mailing = Prospect_list.find_by_name("Hot Leads") 37 mailing.contacts.each do |person| 38 pu...
2006 Jan 30
0
Making sense of all the search options
...;%" + session[:q] + "%", "%" + session[:q] + "%" ], :order => ''username ASC'' What I need is one search function that does this by default, but also allows me to search each value independently. I''d love to use a find_by_first_name() finder, but these are all "like" searches, which isn''t supported in that fashion. This all ends up looking pretty ugly in the code. So, on to some gems and other add-ons. * Ferret looks awesome, but overkill for this purpose. * SearchGenerator might do it, but all I need i...