Hello Folks!

Im trying to have several model classes inherit from a new class, which
in turn inherits from ActiveRecord::Base. The problem is that my
controller's database calls to the original model classes now look for
the information in the new class's database table, even though it doesnt
exist there.

class RawDatum inherits from class ArchModel
RawDataController calls RawDatum.all
generates SQL: "SELECT "arch_models".* FROM "arch_models" ORDER BY
raw_data.timestamp DESC"
correct SQL: "SELECT "raw_data".* FROM "raw_data" ORDER BY
raw_data.timestamp DESC"

The new class is for providing methods that process data from other
models, and to make the corresponding method calls short and simple. It
doesn't need its own database table at all. The desired functionality
already worked before, but the implementation was badly structured.

Does anyone have an idea on how to make this work?

Posted via http://www.ruby-forum.com/.

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bbb49b9988452da4a76c92b40f6b6c70%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
grouprubyonrails-talk @
postedJun 11, '16 at 2:08p
activeJun 13, '16 at 12:11p

2 users in discussion

Greg Navis: 1 post Rynn Steinbolt: 1 post



site design / logo © 2021 Grokbase