From fbcda9cdd6d34c889c617010e25efdaeebe427e7 Mon Sep 17 00:00:00 2001 From: Didier Lafforgue Date: Sun, 10 Jun 2012 01:31:10 +0200 Subject: [PATCH] simply re-organize little piece of code (cleaning stuff) --- Gemfile.lock | 6 +++--- app/models/locomotive/account.rb | 24 ++++++++++++------------ config/routes.rb | 8 +++++++- lib/locomotive/dependencies.rb | 1 + lib/locomotive/devise.rb | 1 - 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0aa2d497..b7831f9b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -113,10 +113,10 @@ GEM sass (~> 3.1) compass-rails (1.0.2) compass (>= 0.12.0, < 0.14) - cucumber (1.2.0) + cucumber (1.2.1) builder (>= 2.1.2) diff-lcs (>= 1.1.3) - gherkin (~> 2.10.0) + gherkin (~> 2.11.0) json (>= 1.4.6) cucumber-rails (1.3.0) capybara (>= 1.1.2) @@ -167,7 +167,7 @@ GEM formtastic (2.0.2) rails (~> 3.0) fssm (0.2.9) - gherkin (2.10.0) + gherkin (2.11.0) json (>= 1.4.6) haml (3.1.6) highline (1.6.12) diff --git a/app/models/locomotive/account.rb b/app/models/locomotive/account.rb index ccedd1e4..fe22d8cd 100644 --- a/app/models/locomotive/account.rb +++ b/app/models/locomotive/account.rb @@ -6,18 +6,18 @@ module Locomotive devise *Locomotive.config.devise_modules ## devise fields (need to be declared since 2.x) ## - field :remember_created_at, :type => Time - field :email, :type => String, :null => false - field :encrypted_password, :type => String, :null => false - field :authentication_token, :type => String - field :reset_password_token, :type => String - field :reset_password_sent_at, :type => Time - field :password_salt, :type => String - field :sign_in_count, :type => Integer - field :current_sign_in_at, :type => Time - field :last_sign_in_at, :type => Time - field :current_sign_in_ip, :type => String - field :last_sign_in_ip, :type => String + field :remember_created_at, :type => Time + field :email, :type => String, :null => false + field :encrypted_password, :type => String, :null => false + field :authentication_token, :type => String + field :reset_password_token, :type => String + field :reset_password_sent_at, :type => Time + field :password_salt, :type => String + field :sign_in_count, :type => Integer + field :current_sign_in_at, :type => Time + field :last_sign_in_at, :type => Time + field :current_sign_in_ip, :type => String + field :last_sign_in_ip, :type => String ## attributes ## field :name diff --git a/config/routes.rb b/config/routes.rb index 86156e9d..428dba58 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,13 @@ Locomotive::Engine.routes.draw do # authentication - devise_for :locomotive_account, :class_name => 'Locomotive::Account', :path => '', :path_prefix => nil, :failure_app => 'Locomotive::Devise::FailureApp',:controllers => { :sessions => 'locomotive/sessions', :passwords => 'locomotive/passwords' } + devise_for :locomotive_account, + :class_name => 'Locomotive::Account', + :path => '', + :path_prefix => nil, + :failure_app => 'Locomotive::Devise::FailureApp', + :controllers => { :sessions => 'locomotive/sessions', :passwords => 'locomotive/passwords' } + devise_scope :locomotive_account do match '/' => 'sessions#new' delete 'signout' => 'sessions#destroy', :as => :destroy_locomotive_session diff --git a/lib/locomotive/dependencies.rb b/lib/locomotive/dependencies.rb index 57c06bfb..a25952fc 100644 --- a/lib/locomotive/dependencies.rb +++ b/lib/locomotive/dependencies.rb @@ -3,6 +3,7 @@ require 'mongoid/railtie' require 'mongoid/tree' require 'devise' require 'devise/orm/mongoid' +require 'devise-encryptable' require 'kaminari' require 'haml' require 'liquid' diff --git a/lib/locomotive/devise.rb b/lib/locomotive/devise.rb index 53a01e38..22ded327 100644 --- a/lib/locomotive/devise.rb +++ b/lib/locomotive/devise.rb @@ -1,2 +1 @@ # patches for devise here -require 'devise-encryptable'