Rails - Accessing model class methods from within ActiveRecord model

Posted by aaronrussell on Stack Overflow See other posts from Stack Overflow or by aaronrussell
Published on 2010-06-03T16:02:14Z Indexed on 2010/06/03 16:04 UTC
Read the original article Hit count: 270

Filed under:
|
|
|

I have a simple standalone model that doesn't inherit from ActiveRecord or anything else, called SmsSender. As the name suggests, it delivers text messages to an SMS gateway.

I also have an ActiveRecord model called SmsMessage which has an instance method called deliver:

def deliver
  SmsSender.deliver_message(self)
  self.update_attributes :status => "Sent"
end

The above is returning uninitialized constant SmsSender. I'm sure this is dead simple, but how can I access the SmsSender class from within my model?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby