Created
April 24, 2013 14:37
-
-
Save telagraphic/5452620 to your computer and use it in GitHub Desktop.
This file contains 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
NoMethodError in FeedsController#index | |
undefined method `feed_read' for #<ActiveRecord::Relation:0x007fc784132d58> | |
Rails.root: /Users/telagraphic/Documents/programming/rails_projects/codebase | |
Application Trace | Framework Trace | Full Trace | |
app/controllers/feeds_controller.rb:7:in `index' |
This file contains 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
class Feed < ActiveRecord::Base | |
attr_accessible :model_id, :model_name | |
belongs_to :user | |
def feed_read | |
@feed_list = Feed.all | |
@feed_display = [] | |
@feed_list.each do |feed| | |
case feed.model_name | |
when "Link" then @feed_display << Link.find_by_id(feed.model_id) | |
when "Code" then @feed_display << Code.find_by_id(feed.model_id) | |
when "Screen" then @feed_display << Screen.find_by_id(feed.model_id) | |
end | |
end | |
return @feed_display | |
end | |
default_scope order: 'created_at DESC' | |
end |
This file contains 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
class FeedsController < ApplicationController | |
def index | |
@user_feed = current_user.feeds | |
@feed_display = @user_feed.feed_read | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment