We are starting a project based on Ruby on Rails. We used to work with Perl and PostgreSQL functions, and with Rails and Active Record I\'ve not seen how we are supposed to
If your only requirement is creating them somewhere in your Rails app, this is possible through ActiveRecord::Base.connection.execute
, which you can use to execute raw SQL queries.
stmt = 'CREATE FUNCTION...'
ActiveRecord::Base.connection.execute stmt
You would then call the function using ActiveRecord::Base.connection.execute
as well (I'd imagine you'd have methods in your model to handle this).