I assume this is a bug with find :last?>> capella.ps.last=> #<Program id: 888, name: "Post-... deleted_reason: nil> # worked>> capella.ps.find :lastActiveRecord::RecordNotFound: Couldn''t find Program with ID=6329 AND (programs.school_id = 6) from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1267:in `find_one'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1250:in `find_from_ids_without_coercion'' from /Users/rogerpack/dev/degreesearch/vendor/plugins/acts_as_sluggable/lib/active_record_overrides.rb:12:in `find_from_ids'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:in `find'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_many_association.rb:66:in `find'' from (irb):7 from :0 :) Before I submit it wanted to check. -R -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 Jun 6, 7:43 pm, Roger Pack <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I assume this is a bug with find :last?>> capella.ps.last > > => #<Program id: 888, name: "Post-... deleted_reason: nil> # worked>> capella.ps.find :last >Nope it''s because you''re running rails 2.0.2, which doesn''t have find :last. capella.ps.last works but that''s an array.last (ie the same as [1,2,3,4].last: it''s loading the whole array and then returning the last element Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 06 June 2008 20:43:02 Roger Pack wrote:> => #<Program id: 888, name: "Post-... deleted_reason: nil> # worked > > >> capella.ps.find :lastInstead, do capella.ps.find :first, :order => "id DESC" Which item is "last" in a SQL query depends on what you''re ordering the query on, so you could use created_at or something else instead of id. Ciao, Sheldon. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFISnr8pGJX8XSgas0RApgqAJ9splmd5cj+uBtvUDde/3vd+AWVQwCgq8lK 9Amp8nwap4tHngfJVb4t36g=Bhg1 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Nope it''s because you''re running rails 2.0.2, which doesn''t have > find :last. > capella.ps.last works but that''s an array.last (ie the same as > [1,2,3,4].last: it''s loading the whole array and then returning the > last element > > Fredcool. thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---