Forum: Ruby on Rails Accessing Metaweblog API

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David S. (Guest)
on 2006-02-16 10:46
(Received via mailing list)
I'm trying to create an application that interfaces with the metaweblog
API of a remote blog.

I've installed a nifty little ruby module called "blog/client" and have
it connecting, and then pulling posts from a blog via the metaweblog API
if I put all the code into my controller.

Now, I wanted to try and put the code into a model so that I can create
a new connection to the blog using @blog = Blog.new(id) and then save
posts back to the blog using @blog.save(post).

Obviously as this doesn't have an associated database table it shouldn't
inherit from activerecord::base (is this a correct assumption?). I've
tried creating a model like this but Rails just complains back to me

"undefined method `new' for Blog:Module"

Even though I have specified a new and initialize method within the
blog.rb model.

Am I going about this the right way? Should I just leave the code in the
controller?

There is a brief mention in the pragmatic programmers rails book on
creating models
that do not inherit from ActiveRecord::Base, but this doesn't give
enough information
to be able to suss this out.

David

----------------------
David S.
removed_email_address@domain.invalid
This topic is locked and can not be replied to.