marnen / positron

Don't leak ActiveRecord details into your Rails models!
MIT License
0 stars 0 forks source link

Basic Positron class method interface #1

Closed marnen closed 10 years ago

marnen commented 10 years ago

As a user I can include Positron into a class So that I can use it to encapsulate ActiveRecord finders

Interface idea:

class Model # not ActiveRecord
  include Positron

  def self.find(id)
    db.find id # proxies to an ActiveRecord class, returns (for now) an instance of that class
  end
end
marnen commented 10 years ago

Blocked for #4, so we can get decent tests going.

marnen commented 10 years ago

We should make sure that the ActiveRecord class takes its table name from the model class. So

class User
  include Positron
end

User.send(:db).table_name.should == 'users'