Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed Facebook like button

  • Loading branch information...
commit 78bba166ba19e477b4f39ccbdd3bdd50d14dd84d 1 parent 3ee61ff
@fred authored
View
3  app/models/facebook_share.rb
@@ -1,7 +1,6 @@
class FacebookShare < Share
belongs_to :item
after_create :enqueue
- delegate :url_helpers, to: 'Rails.application.routes'
def post(item)
self.processed_at = Time.now
@@ -9,7 +8,7 @@ def post(item)
@graph = Koala::Facebook::API.new(user.oauth_token)
@page_token = @graph.get_page_access_token(Settings.facebook_page_id)
@page_graph = Koala::Facebook::API.new(@page_token)
- url = url_helpers.item_path(item, only_path: false, host: Settings.host)
+ url = Rails.application.routes.url_helpers.item_path(item, only_path: false, host: Settings.host)
if @page_graph
res = @page_graph.put_wall_post(item.title, {name: item.title, link: url})
end
View
2  app/views/shared/_facebook.html.erb
@@ -10,4 +10,4 @@
}(document, 'script', 'facebook-jssdk'));
</script>
-<div class="fb-like" data-href="<%= item_path(@item) %>" data-send="false" data-width="270" data-show-faces="false"></div>
+<div class="fb-like" data-href="<%= item_path(@item, only_path: false, protocol: 'http') %>" data-send="false" data-width="270" data-show-faces="false"></div>
View
3  config/rsync.yml
@@ -0,0 +1,3 @@
+rsync_url: 'fred@worldmathaba.net'
+remote_dir: '/home/fred/backup/'
+local_dir: './backup/'
View
1  db/truncate.sql
@@ -21,6 +21,5 @@ truncate table simple_captcha_data ;
truncate table subscriptions ;
truncate table taggings ;
truncate table tags ;
-truncate table translations ;
truncate table users ;
truncate table versions ;
View
25 lib/tasks/reload_db.rake
@@ -0,0 +1,25 @@
+#!/bin/env ruby
+require 'yaml'
+
+namespace :db do
+ task :pull => :environment do
+ db_config = Rails.application.config.database_configuration[Rails.env]
+ rsync_config = YAML.load_file(File.join(Rails.root, "config", "rsync.yml"))
+ db_config = Rails.application.config.database_configuration[Rails.env]
+ puts "Syncing from server"
+ sh "rsync -av #{rsync_config['rsync_url']}:#{rsync_config['remote_dir']} #{rsync_config['local_dir']}"
+ @last_restore=`find #{rsync_config['local_dir']} -type f -name data_only_*.sql.gz | tail -n1`.strip
+ puts "Dropping DB"
+ Rake::Task['db:drop'].invoke
+ puts "Creating DB"
+ Rake::Task['db:create'].invoke
+ puts "Migrating DB"
+ Rake::Task['db:migrate'].invoke
+ puts "Truncating DB"
+ sh "psql -d #{db_config['database']} -a -f db/truncate.sql"
+ puts "Restoring Last Dump"
+ sh "pg_restore -C -d #{db_config['database']} #{@last_restore}"
+ puts "Reindexing Solr"
+ Rake::Task["sunspot:reindex"].invoke
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.