Moved to rails4.

This commit is contained in:
Martin Edenhofer 2013-08-22 23:15:23 +02:00
parent d769f23f8e
commit 4ca49d6136
3 changed files with 7 additions and 14 deletions

View file

@ -7,6 +7,7 @@ require 'sessions'
class ApplicationModel < ActiveRecord::Base
self.abstract_class = true
before_create :check_attributes_protected, :cache_delete, :fill_up_user_create
before_create :cache_delete, :fill_up_user_create
before_update :cache_delete_before, :fill_up_user_update
before_destroy :cache_delete_before
@ -16,12 +17,11 @@ class ApplicationModel < ActiveRecord::Base
@@import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::Priority', 'Group', 'User' ]
# for import of other objects, remove 'id'
def self.attributes_protected_by_default
def check_attributes_protected
if Setting.get('import_mode') && @@import_class_list.include?( self.name.to_s )
['type']
# do noting, use id as it is
else
['id','type']
self[:id] = nil
end
end
@ -71,7 +71,9 @@ returns
data.delete( :created_at )
data.delete( :updated_by_id )
data.delete( :created_by_id )
if data.respond_to?('permit!')
data.permit!
end
data
end

View file

@ -61,12 +61,6 @@ module Zammad
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
# config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true

View file

@ -15,9 +15,6 @@ Zammad::Application.configure do
config.assets.compile = true
config.assets.digest = true
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = true