I am storing an object of type Feed into my mysql db as a longblob and want to know how to retrieve it without it being of type String.
Is there a way to typecast in ruby/rails that I'm overlooking?
I'm assuming that's whats happening since I get "undefined method `entries' for #
some background in case I did something stupid...
my migrations:
class AddFeedDataToFeeds < ActiveRecord::Migration
def change
add_column :feeds, :feed_data, :longblob
end
end
class FillFeedData < ActiveRecord::Migration
def up
Feed.all.each do |f|
f.update_attribute(:feed_data, Feedzirra::Feed.fetch_and_parse(f.feed_url))
end
end
In my reader controller:
next_feed = Feed.find(session[:unread_random].pop)
@feed = next_feed
In the reader:
<% unless @feed.is_a? Fixnum #protect against bad feed URLs: 404, 503 etc...
@feed.entries.each do |entry| %>
<div class="entry">
<h1><%= entry.title %></h1>
etc... The error throws in the second line of this last code segment.