CompanyBook / massive_record

HBase ruby client
130 stars 39 forks source link

Inheritance and table_name #83

Closed corywilkerson closed 8 years ago

corywilkerson commented 12 years ago

Maybe I'm missing something obvious but I'm noticing that I can't explicitly set table name (using set_table_name) when I've inherited from a superclass.

For instance:

class Foo < MassiveRecord::ORM::Table
  default_scope select(:d)

  column_family :d do
    field :foo, :integer
  end
end

class Bar < Foo
  set_table_name "crazy-bars"
end

When I go to query Bar.first, for example, it infers the table name from "foo" and I'm left looking "foos" (in the Rails log and in Thrift you can see a lookup on "Foos") which is not at all what I'm after...

This is happening in 0.2.1.

Let me know if you need any additional info - this is my first GitHub issue report. Looking forward to learning how to contribute and assisting.

vincentp commented 12 years ago

hey, I will have a look at it next week :) For now, you can probably set the table name using:

class Bar < Foo @table_name = "crazy-bars" end

corywilkerson commented 12 years ago

I'll give it a shot and report back tomorrow.

Happy new year!

On Jan 1, 2012, at 6:24 AM, Vincent Peresreply@reply.github.com wrote:

hey, I will have a look at it next week :) For now, you can probably set the table name using:

class Bar < Foo @table_name = "crazy-bars" end


Reply to this email directly or view it on GitHub: https://github.com/CompanyBook/massive_record/issues/83#issuecomment-3324617

corywilkerson commented 12 years ago

Back at it - still remains an issue. We were able to get around this but moving the column definition off to a module and then extending the class on module include...