Rails Tableless Model

Posted by mplacona on Stack Overflow See other posts from Stack Overflow or by mplacona
Published on 2010-03-13T20:58:28Z Indexed on 2010/03/13 21:05 UTC
Read the original article Hit count: 279

I'm creating a tableless Rails model, and am a bit stuck on how I should use it.

Basically I'm trying to create a little application using Feedzirra that scans a RSS feed every X seconds, and then sends me an email with only the updates.

I'm actually trying to use it as an activerecord model, and although I can get it to work, it doesn't seem to "hold" data as expected.

As an example, I have an initializer method that parses the feed for the first time. On the next requests, I would like to simply call the get_updates method, which according to feedzirra, is the existing object (created during the initialize) that gets updated with only the differences.

I'm finding it really hard to understand how this all works, as the object created on the initialize method doesn't seem to persist across all the methods on the model.

My code looks something like:

def initialize
     feed parse here
end

def get_updates
     feedzirra update passing the feed object here
end

Not sure if this is the right way of doing it, but it all seems a bit confusing and not very clear. I could be over or under-doing here, but I'd like your opinion about this approach.

Thanks in advance

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about model