Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
fixing random by database type.
Browse files Browse the repository at this point in the history
  • Loading branch information
gleuch committed Sep 27, 2009
1 parent 80df4ae commit cf15e40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions retweet.rb
Expand Up @@ -37,8 +37,11 @@ def get_user; @user = User.first(:id => session[:user]) rescue nil; end


def launch_retweet_hell def launch_retweet_hell
# TODO : Better db connection detection # TODO : Better db connection detection
rand = "RANDOM()" # if using SQLite if configatron.db_type.downcase == 'mysql'
#rand = "RAND()" # if using MySQL rand = "RAND()" # if using MySQL
else
rand = "RANDOM()" # if using SQLite
end


@base_users = User.find_by_sql("SELECT id, account_id, screen_name, oauth_token, oauth_secret FROM users ORDER BY #{rand} LIMIT 10") @base_users = User.find_by_sql("SELECT id, account_id, screen_name, oauth_token, oauth_secret FROM users ORDER BY #{rand} LIMIT 10")
@base_users.each do |user| @base_users.each do |user|
Expand Down
11 changes: 7 additions & 4 deletions settings.yml.default
Expand Up @@ -16,16 +16,19 @@ development: &local
use_g_analytics: false use_g_analytics: false
g_analytics_code: UA-#######-## g_analytics_code: UA-#######-##


db_connection: sqlite3:///ROOT/retweet.db db_type: sqlite
db_connection: sqlite3:///ROOT/retweet.db


production: production:
<<: *local <<: *local




site_url: http://www.your-domain.com site_url: http://www.your-domain.com


# db_connection : mysql://root:----@localhost/rtfuck_prod # db_type: mysql
db_connection: sqlite3:///ROOT/retweet.db # db_connection: mysql://root:*****@localhost/rtfuck_prod
db_type: sqlite
db_connection: sqlite3:///ROOT/retweet.db


twitter_retweet_percent: 20 twitter_retweet_percent: 20
twitter_retweet_max: 500 twitter_retweet_max: 500
Expand Down

0 comments on commit cf15e40

Please sign in to comment.