Skip to content
Extraits de code Groupes Projets
Valider 5348c722 rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

add sqlite method; fix chubbies cukes

parent 607013bc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -126,6 +126,7 @@ group :test do ...@@ -126,6 +126,7 @@ group :test do
gem 'rspec-rails', '>= 2.0.0' gem 'rspec-rails', '>= 2.0.0'
gem "selenium-webdriver", "~> 2.7.0" gem "selenium-webdriver", "~> 2.7.0"
gem 'webmock', :require => false gem 'webmock', :require => false
gem 'sqlite3'
end end
group :development do group :development do
......
...@@ -425,6 +425,7 @@ GEM ...@@ -425,6 +425,7 @@ GEM
sinatra (1.2.6) sinatra (1.2.6)
rack (~> 1.1) rack (~> 1.1)
tilt (< 2.0, >= 1.2.2) tilt (< 2.0, >= 1.2.2)
sqlite3 (1.3.4)
subexec (0.0.4) subexec (0.0.4)
systemu (2.4.0) systemu (2.4.0)
term-ansicolor (1.0.6) term-ansicolor (1.0.6)
...@@ -534,6 +535,7 @@ DEPENDENCIES ...@@ -534,6 +535,7 @@ DEPENDENCIES
selenium-webdriver (~> 2.7.0) selenium-webdriver (~> 2.7.0)
settingslogic (= 2.0.6) settingslogic (= 2.0.6)
sod! sod!
sqlite3
thin (= 1.2.11) thin (= 1.2.11)
twitter (= 1.5.0) twitter (= 1.5.0)
typhoeus typhoeus
......
...@@ -7,6 +7,10 @@ def postgres? ...@@ -7,6 +7,10 @@ def postgres?
@using_postgres ||= defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) @using_postgres ||= defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
end end
def sqlite?
@using_sqlite ||= defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) && ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter
end
# Load the rails application # Load the rails application
require File.expand_path('../application', __FILE__) require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5 Haml::Template.options[:format] = :html5
......
...@@ -39,10 +39,11 @@ module Diaspora ...@@ -39,10 +39,11 @@ module Diaspora
posts_from_self = posts_from_self.joins(:aspect_visibilities).where(:aspect_visibilities => {:aspect_id => opts[:by_members_of]}) posts_from_self = posts_from_self.joins(:aspect_visibilities).where(:aspect_visibilities => {:aspect_id => opts[:by_members_of]})
end end
unless defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) && ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter unless sqlite?
posts_from_others = posts_from_others.select(select_clause).limit(opts[:limit]).order(order_with_table).where(Post.arel_table[order_field].lt(opts[:max_time])) posts_from_others = posts_from_others.select(select_clause).order(order_with_table).where(Post.arel_table[order_field].lt(opts[:max_time]))
posts_from_self = posts_from_self.select(select_clause).limit(opts[:limit]).order(order_with_table).where(Post.arel_table[order_field].lt(opts[:max_time])) posts_from_self = posts_from_self.select(select_clause).order(order_with_table).where(Post.arel_table[order_field].lt(opts[:max_time]))
all_posts = "(#{posts_from_others.to_sql}) UNION ALL (#{posts_from_self.to_sql}) ORDER BY #{opts[:order]} LIMIT #{opts[:limit]}"
all_posts = "(#{posts_from_others.to_sql} LIMIT #{opts[:limit]}) UNION ALL (#{posts_from_self.to_sql} LIMIT #{opts[:limit]}) ORDER BY #{opts[:order]} LIMIT #{opts[:limit]}"
else else
posts_from_others = posts_from_others.select(select_clause) posts_from_others = posts_from_others.select(select_clause)
posts_from_self = posts_from_self.select(select_clause) posts_from_self = posts_from_self.select(select_clause)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter