0

I'm working on library which should support 2.x and 3.x versions of Rails.

In this library I'm queering some data from database.

Is there already built gem which can help to write query once and it will work on either Rails 2 or Rails 3?

megas
  • 21,401
  • 12
  • 79
  • 130

1 Answers1

0

you could split up your library into different modules. if rails 2 is current rails version -> you can include rails 2 modules (which contain rails 2 queries), otherwise rails 3 specific files. generate functions for the queries and define these function in the different modules with the different syntax.

Matthias
  • 4,355
  • 2
  • 25
  • 34
  • Yes, I could but won't be the write once query – megas Apr 26 '13 at 13:41
  • Hmm yes I know, but I think it is not possible to write once a query, with 2 different active record interfaces..and I don´t know a already existing gem. – Matthias Apr 26 '13 at 13:53