I'm starting my way into Ruby development and have some questions that I hope you can give your best opinion to better design some command line applications I'm developing.
What are the best patterns when creating data layers in Ruby? I've seen a lot of articles talking about ORMs (ActiveRecords and others) and also saw articles where classes are created with self methods that make SQL queries, meaning that the model is aware of its own persistence implementation details.
Due to my C# experience I work a lot with repository patterns and I'm really not used to put all my DataLayer logic directly inside the model classes so I tend to look at those kind of approaches as "not" best practices.
As an example, if you have a class Manager with some methods where all the business logic resides and you need to get a class Foo from a SQL database, would you create a class to act as a SQL repository with all the data access implementation there, e.g. SqlRepo.find_foo("1"), or would you just create self methods on the Foo class, each with the persistence detail needed such as Foo.find("1")? Any other better ideas?
Another question that comes to mind is the Ruby on Rails. As far as I know its just a MVC framework for Ruby web development. Some articles talk about ActiveRecords ORM and other subjects in a way that it seems that those gems are almost exclusive for Rails development. Is that only because Rails is very popular, almost more than Ruby itself, and because of that most blogs are from Rails guys so they talk in their comfort zone?