Tag Archives: design patterns

Singleton Classes

How can you create a singleton class in a Rails application? The same as in a Ruby application! Using Singleton gives you free functionality: it makes the constructor private, and it creates a static method called instance, to get the singleton instance. If you check equality for two singleton instances, they will always be equal. We discuss a brief example. Continue reading

Posted in Development | Tagged , | 2 Comments

Hello Rails! Autopsy – Smart MVC

Rails enforces separation of model, view, and controller code. Most tutorials encourage you to make a single controller per model. But there’s a smarter way you can use MVC–you can create one controller per user group. This gives you an easy, intuitive model of how users access your application, and provide all the logic per user-group in one location. Continue reading

Posted in Development | Tagged , , | Comments Off