module Hijacker::ControllerMethods::Instance
Public Instance Methods
determine_databases()
click to toggle source
Returns 2-member array of the main database to connect to, and the sister (sister will be nil if no master is found, which means we are on the master).
# File lib/hijacker/controller_methods.rb, line 22 def determine_databases Hijacker::RequestParser.from_request(request).determine_databases end
hijack_connection()
click to toggle source
# File lib/hijacker/controller_methods.rb, line 4 def hijack_connection master, sister = determine_databases Hijacker.connect(master, sister) return true rescue Hijacker::InvalidDatabase => e render_invalid_db # If we've encountered a bad database connection, we don't want # to continue rendering the rest of the before_filters on this, which it will # try to do even when just rendering the bit of text above. If any filters # return false, though, it will halt the filter chain. return false end
render_invalid_db()
click to toggle source
# File lib/hijacker/controller_methods.rb, line 26 def render_invalid_db render :text => "You do not appear to have an account with us (#{request.host})", :status => 404 end