Hi,
I would like to write a singleton virtual model (using Rails 3).
Here is my code:
class App
extend ActiveModel::Naming
include ActiveRecord::Associations
include ActiveRecord::Reflection
has_many :users
def self.name
'MyApp'
end
end
But that's not enough. If for instance I try this in Rails console:
> App.first
I get this raised message:
NoMethodError: undefined method `first' for App:Class from (irb):1
Edit
I would also and especially be able to do this:
> App.first.users
Thank you for any ideas.