Rails4 migration.
This commit is contained in:
parent
5878b239dc
commit
e9a21228ec
7 changed files with 21 additions and 32 deletions
19
Gemfile
19
Gemfile
|
@ -1,11 +1,8 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.2.14'
|
||||
|
||||
# preparation for rails 4
|
||||
#gem 'rails', '4.0.0.rc1'
|
||||
#gem 'rails-observers'
|
||||
#gem 'activerecord-session_store'
|
||||
gem 'rails', '4.0.0'
|
||||
gem 'rails-observers'
|
||||
gem 'activerecord-session_store'
|
||||
|
||||
gem 'eco'
|
||||
|
||||
|
@ -19,10 +16,8 @@ gem 'json'
|
|||
group :assets do
|
||||
|
||||
# preparation for rails 4
|
||||
# gem 'sass-rails', '~> 4.0.0.rc1'
|
||||
# gem 'coffee-rails', '~> 4.0.0.rc1'
|
||||
gem 'sass-rails', '~> 3.2.4'
|
||||
gem 'coffee-rails', '~> 3.2.2'
|
||||
gem 'sass-rails', '~> 4.0.0'
|
||||
gem 'coffee-rails', '~> 4.0.0'
|
||||
gem 'uglifier'
|
||||
end
|
||||
|
||||
|
@ -76,6 +71,8 @@ gem 'em-websocket'
|
|||
# in production environments by default.
|
||||
group :development, :test do
|
||||
|
||||
gem 'test-unit'
|
||||
|
||||
gem 'sqlite3'
|
||||
|
||||
# code coverage
|
||||
|
@ -92,4 +89,4 @@ group :development, :test do
|
|||
# gem 'em-websocket-client'
|
||||
end
|
||||
|
||||
gem 'thin'
|
||||
gem 'puma'
|
||||
|
|
|
@ -14,7 +14,8 @@ class ApplicationController < ActionController::Base
|
|||
:mode_show_rendeder,
|
||||
:model_index_render
|
||||
|
||||
before_filter :log_request, :set_user, :session_update
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_filter :set_user, :session_update
|
||||
before_filter :cors_preflight_check
|
||||
|
||||
after_filter :set_access_control_headers
|
||||
|
@ -52,10 +53,6 @@ class ApplicationController < ActionController::Base
|
|||
Observer::Ticket::Notification.transaction
|
||||
end
|
||||
|
||||
def log_request
|
||||
puts Time.now().to_s + ' ' + request.original_fullpath.to_s
|
||||
end
|
||||
|
||||
# Finds the User with the ID stored in the session with the key
|
||||
# :current_user_id This is a common way to handle user login in
|
||||
# a Rails application; logging in sets the session value and
|
||||
|
@ -257,7 +254,7 @@ class ApplicationController < ActionController::Base
|
|||
begin
|
||||
|
||||
# create object
|
||||
generic_object = object.new( object.param_cleanup(params) )
|
||||
generic_object = object.new( object.param_cleanup( params[object.to_s.downcase] ) )
|
||||
|
||||
# save object
|
||||
generic_object.save!
|
||||
|
@ -280,7 +277,7 @@ class ApplicationController < ActionController::Base
|
|||
generic_object = object.find( params[:id] )
|
||||
|
||||
# save object
|
||||
generic_object.update_attributes!( object.param_cleanup(params) )
|
||||
generic_object.update_attributes!( object.param_cleanup( params[object.to_s.downcase] ) )
|
||||
model_update_render_item(generic_object)
|
||||
rescue Exception => e
|
||||
logger.error e.message
|
||||
|
|
|
@ -53,7 +53,7 @@ class TicketsController < ApplicationController
|
|||
if params[:article]
|
||||
form_id = params[:article][:form_id]
|
||||
params[:article].delete(:form_id)
|
||||
@article = Ticket::Article.new( params[:article] )
|
||||
@article = Ticket::Article.new( Ticket::Article.param_validation( params[:article] ) )
|
||||
@article.ticket_id = @ticket.id
|
||||
|
||||
# find attachments in upload cache
|
||||
|
|
|
@ -79,11 +79,5 @@ module Zammad
|
|||
# REST api path
|
||||
config.api_path = '/api/v1'
|
||||
|
||||
# Enable threaded mode
|
||||
config.threadsafe!
|
||||
|
||||
# catch all router files
|
||||
config.paths['config/routes'] += Dir[Rails.root.join("config/routes/*.rb")]
|
||||
|
||||
end
|
||||
end
|
|
@ -6,9 +6,6 @@ Zammad::Application.configure do
|
|||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# 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 = false
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,4 +8,11 @@ Zammad::Application.routes.draw do
|
|||
# just remember to delete public/index.html.
|
||||
root :to => 'init#index', :via => :get
|
||||
|
||||
# load routes from external files
|
||||
dir = File.expand_path('../', __FILE__)
|
||||
files = Dir.glob( "#{dir}/routes/*.rb" )
|
||||
for file in files
|
||||
require file
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue