Moved to rails 4.1.

This commit is contained in:
Martin Edenhofer 2014-05-20 21:49:48 +02:00
parent 9841ce75e5
commit 3b766c81cf
4 changed files with 14 additions and 23 deletions

View file

@ -1,6 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '4.0.3'
gem 'rails', '4.1.0'
gem 'rails-observers'
gem 'activerecord-session_store'
@ -14,8 +14,8 @@ gem 'json'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 4.0.1'
gem 'coffee-rails', '~> 4.0.1'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
end

View file

@ -41,21 +41,15 @@ returns
# fallback do sql query
# - stip out * we already search for *query* -
query.gsub! '*', ''
organizations = Organization.find(
:all,
:limit => limit,
:conditions => ['name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"],
:order => 'name'
)
organizations = Organization.where(
'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"
).order('name').limit(limit)
# if only a few organizations are found, search for names of users
if organizations.length <= 3
organizations_by_user = Organization.select('DISTINCT(organizations.id)').joins('LEFT OUTER JOIN users ON users.organization_id = organizations.id').find(
:all,
:limit => limit,
:conditions => ['users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%"],
:order => 'organizations.name'
)
organizations_by_user = Organization.select('DISTINCT(organizations.id)').joins('LEFT OUTER JOIN users ON users.organization_id = organizations.id').where(
'users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%"
).order('organizations.name').limit(limit)
organizations_by_user.each {|organization_by_user|
organization_exists = false
organizations.each {|organization|

View file

@ -91,8 +91,8 @@ returns
where(conditions).
where( '( `tickets`.`title` LIKE ? OR `tickets`.`number` LIKE ? OR `ticket_articles`.`body` LIKE ? OR `ticket_articles`.`from` LIKE ? OR `ticket_articles`.`to` LIKE ? OR `ticket_articles`.`subject` LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" ).
joins(:articles).
limit(limit).
order('`tickets`.`created_at` DESC')
order('`tickets`.`created_at` DESC').
limit(limit)
# build result list
tickets = []

View file

@ -57,12 +57,9 @@ returns
# fallback do sql query
# - stip out * we already search for *query* -
query.gsub! '*', ''
users = User.find(
:all,
:limit => limit,
:conditions => ['(firstname LIKE ? or lastname LIKE ? or email LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%"],
:order => 'firstname'
)
users = User.where(
'(firstname LIKE ? or lastname LIKE ? or email LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%",
).order('firstname').limit(limit)
return users
end