Created
November 18, 2011 02:17
-
-
Save takuyan/1375371 to your computer and use it in GitHub Desktop.
kaminari Array issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/medium.rb | |
has_many :stories | |
# app/models/stories.rb | |
belongs_to :medium | |
scope :newer, order("created_at desc") | |
scope :entries, where("entry = ?", true) | |
# app/controllers/stories_controller.rb | |
def index | |
@medium = Medium.find params[:id] | |
@stories = @medium.stories.newer.entries.page params[:page] | |
# => undefined method `page' for #<Array…> | |
@stories2 = @medium.stories.newer.entries # => Dir::entries ??? | |
@entries2.class # => Array | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MacBook-Pro@takuyan:kami $ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.0.0]
MacBook-Pro@takuyan:kami $ rails -v
Rails 3.0.10