Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

<Model>.offset(x).limit(x) unknown offset method exception

#5688

run rails console

Type:
Team.offset(1).limit(1)
call will fail

Team.limit(1).offset(1) works great.

Reason for this is in my opinion a missing delegate call for :offset in ActiveRecord Base:
delegate :select, :group, :order, :reorder, :limit, :joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly, :having, :create_with, :to => :scoped

Reported by vhochstein · September 23rd, 2010 @ 09:04 AM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. David Trasbo
    David Trasbo
    • State changed from new to open
    • Importance changed from to Low

    September 23rd, 2010 @ 09:29 AM

  2. Marcelo Giorgi
    Marcelo Giorgi
    • Tag set to activerecord, patched, scope

    Hi vhochstein,

    Yeah, I totally agree, it should behave in the same way as #limit.

    Here I provide a couple of tests and a patch for this case based on your suggestion.

    BTW: This patch applies cleanly on master right now.

    Any thoughts?

    September 23rd, 2010 @ 11:22 PM

  3. Repository
    Repository
    • State changed from open to resolved

    (from [72543b2e6358a502257a0e1eac61b0e3164937dd]) Delegate ActiveRecord::Base.offset to scoped methods (analogous to limit) [#5688 <Model>.offset(x).limit(x) unknown offset method exception state:resolved]

    Signed-off-by: Santiago Pastorino santiago@wyeworks.com
    http://github.com/rails/rails/commit/72543b2e6358a502257a0e1eac61b0...

    September 25th, 2010 @ 12:25 AM

  4. Repository
  5. Andrea Campi
    Andrea Campi
    • Tag changed from activerecord, patched, scope to activerecord, patch, scope

    bulk tags cleanup

    October 11th, 2010 @ 07:23 AM