On Wed, Jul 12, 2017 at 6:33 AM, Ralph Shnelvar <[email protected]> wrote:
> I _think_ I need to do something like "sudo -i -u SomeOtherPostgresUserName" > but I want to do it inside Rails so I can connect to databases as user > SomeOtherPostgresUserName. I would look at ActiveRecord::Base.establish_connection() which accepts either an atom representing an entry in your config/database.yml or a hash with DB login credentials. Aside: > class RalphSql > def self.exec_sql(sql_text) > begin > # Return an array of records > return ActiveRecord::Base.connection.execute(sql_text) I hope you really really REALLY trust the input from your users and do very frequent backups :-) HTH! -- Hassan Schroeder ------------------------ [email protected] twitter: @hassan Consulting Availability : Silicon Valley or remote -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAVE1xS9wrdULocr-aebsGqEqq_-nqXzQ_eY7s0aEsbAw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

