This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomDevise::SessionsController < Devise::SessionsController | |
def create | |
anonymous_cart = Cart.where(:security_hash => session[:security_hash]).last unless session[:security_hash].nil? | |
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new") | |
set_flash_message :notice, :signed_in | |
if anonymous_cart && !anonymous_cart.user_id? | |
resource.cart.delete if resource.cart | |
anonymous_cart.update_attribute(:user_id, resource.id) | |
end | |
sign_in_and_redirect(resource_name, resource) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# needs the "hashie" gem in Gemfile | |
require 'erb' | |
module Movies | |
class Application < Rails::Application | |
settings = ERB.new(IO.read(File.expand_path('../settings.yml', __FILE__))).result | |
mash = Hashie::Mash.new(YAML::load(settings)[Rails.env.to_s]) | |
mash.each do |key, value| |
NewerOlder