Can I use stored procedures with ruby on rails ?
I am using mysql as database and ruby on rails.
please provide me any of the example for this.
Can I use stored procedures with ruby on rails ?
I am using mysql as database and ruby on rails.
please provide me any of the example for this.
Duplicate ? if not:
class MyRubyClass < ActiveRecord::Base
def self.select_some_records
connection.select_all "exec mysql_stored_proc 'argument1', 'argument2'"
end
end
to enable use of stored procedures look at this
I would recommend you do your business logic IN rails.
Writing your own queries to execute in rails is awkward, error prone, and not likely portable to other databases.