rod mclaughlin


Another Rails tip (07 sep 10)

One criticism of Rails is that it forces developers to follow its conventions.

It does not.

It is easier to override conventions in Rails than it is to FOLLOW the conventions in any other framework.

For example, Rails usually puts models, which are classes which correspond to rows in tables in a database schema, in app/views/models.

Suppose you have several Rails projects which share the same tables in the same database.

To avoid maintaining several copies of app/views/models, you want the projects to share the models.

Here is how to do it: http://old.nabble.com/Having-two-rails-apps-share-the-same-models-td17053502.html

Put all the models in a common folder, eg. common/app/models, then add this

  config.load_paths += %W( #{RAILS_ROOT}/../common/app/models )

to config/environment.rb in each of the Rails projects.



Back
Portland London