Check if a class inherits from ActiveRecord::Base?

11 views
Skip to first unread message

Cyrille

unread,
Jun 28, 2009, 6:29:59 PM6/28/09
to WellRailed
Hi guys,

I can't find a clean way to see if a class inherits from
ActiveRecord::Base...

At the moment, I do:

respond_to?(:id_before_type_cast)

But it's obviously a half-arsed solution...

Anybody can suggest something better?

Cheers

Cyrille

Tim Haines

unread,
Jun 28, 2009, 6:32:49 PM6/28/09
to WellR...@googlegroups.com

Henry Maddocks

unread,
Jun 28, 2009, 6:50:12 PM6/28/09
to WellR...@googlegroups.com

On 29/06/2009, at 10:32 AM, Tim Haines wrote:

.is_a?   http://www.ruby-doc.org/core/classes/Object.html#M000371


I've had problems in the past with is_a? but I can't remember why. The docs imply they are the same though.

Cyrille

unread,
Jun 28, 2009, 7:35:51 PM6/28/09
to WellRailed
Of course!

Thanks guys.

On Jun 29, 10:50 am, Henry Maddocks <henry.maddo...@gmail.com> wrote:
> On 29/06/2009, at 10:32 AM, Tim Haines wrote:
>
> > .is_a?  http://www.ruby-doc.org/core/classes/Object.html#M000371
>
> See also kind_ofhttp://apidock.com/ruby/Object/kind_of%3F
Reply all
Reply to author
Forward
0 new messages