1 class User < ActiveRecord::Base
5 # Include default devise modules. Others available are:
6 # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
7 devise :database_authenticatable, :registerable,
8 :recoverable, :rememberable, :trackable, :validatable,
9 :omniauthable#, :confirmable
12 self.ensure_authentication_token
17 self.authentication_token = nil
24 self.author.scrolls.each do |scroll|
25 raise ActiveRecord::Rollback unless scroll.destroy_with_scroll_panel
27 self.author.panels.each do |panel|
28 raise ActiveRecord::Rollback unless panel.destroy_with_elements
31 self.artist.original_pictures.each do |original_picture|
32 raise ActiveRecord::Rollback unless original_picture.destroy_with_resource_picture
34 raise ActiveRecord::Rollback unless self.artist.destroy
36 raise ActiveRecord::Rollback unless self.author.destroy
37 raise ActiveRecord::Rollback unless super
45 params.require(:user).permit(:email, :password, :password_confirmation, :remember_me, :authentication_token)