Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some bug fixes

putting revision number and hostname into ENV variable
  • Loading branch information...
commit 56c56561e427cbac42e41acc301af568210beccc 1 parent c4ab4f6
aross aross authored
8 README.md
View
@@ -33,23 +33,23 @@ Follow the instructions after the packages install for initializing your databas
Install the bundle:
-
+<pre>
<code>
[sudo] gem install bundler
bundle install
</code>
-
+</pre>
__Note for OS X:__ *You may need to specify additional compile options for your gems. Try: `ARCHFLAGS="-arch x86_64" bundle install`
### B. Database setup
Running the following commands will create an 'opencongress' user and empty databases for the three environments (test, development, production). The migration command will populate the development database with an empty schema.
-
+<pre>
<code>
rake db:init
rake db:migrate
</code>
-
+</pre>
### C. Solr (optional, recommended)
OpenCongress uses Solr to store some data. Running Solr is not required to run the web server, but some pages will break if Solr is not running. If you are going to import data, running solr is required or you will encounter errors.
2  app/controllers/api_controller.rb
View
@@ -324,7 +324,7 @@ def handle_per_page
end
def do_render_paginated(relation, parameters = {})
- do_render(relation.offset((@page-1) * @per_page).limit(@per_page), parameters)
+ do_render(relation.offset((@page.to_i-1) * @per_page).limit(@per_page), parameters)
end
def do_render(object, parameters = {})
6 app/controllers/notebook_items_controller.rb
View
@@ -84,6 +84,12 @@ def destroy
protected
def notebook_env
get_user_or_group
+
+ unless (@user || @group)
+ redirect_to "/"
+ return false
+ end
+
get_notebook
set_title
set_profile_nav_location
2  app/controllers/profile_controller.rb
View
@@ -89,7 +89,7 @@ def actions
@title_class = "tab-nav"
- @atom = {'link' => url_for(:only_path => false, :controller => 'user_feeds', :login => @user.login, :action => 'actions', :key => current_user.feed_key), 'title' => "#{@user.login}'s Actions"}
+ @atom = {'link' => url_for(:only_path => false, :controller => 'user_feeds', :login => @user.login, :action => 'actions', :key => logged_in? ? current_user.feed_key : nil), 'title' => "#{@user.login}'s Actions"}
@my_comments = Comment.paginate(:all, :conditions => ["user_id = ?", @user.id], :order => "created_at DESC", :page => params[:page])
1  app/views/layouts/_header.html.erb
View
@@ -1,3 +1,4 @@
+<!-- HOST: <%= ENV['APP_SERVER'] %> -->
<div id="header" class="clearfix">
<div class="bar">
3  config/application.rb
View
@@ -60,6 +60,9 @@ class Application < Rails::Application
ENV['FACEBOOKER_CALLBACK_PATH'] = '/facebook'
+ # we'll use this just to help debug live servers
+ ENV['APP_SERVER'] = %x{hostname}.rstrip
+
# following should go in application_settings.yml, but it appears settingslogic
# does not support hashes
CONGRESS_START_DATES = {
4 config/environments/production.rb
View
@@ -12,11 +12,11 @@
# config.action_controller.asset_host = "http://assets.example.com"
# Use the git revision of this release
- RELEASE_NUMBER = %x{cat REVISION | cut -c -7}.rstrip
+ ENV['RELEASE_NUMBER'] = %x{cat REVISION | cut -c -7}.rstrip
# Enable serving of images, stylesheets, and javascripts from CloudFront
config.action_controller.asset_host = Proc.new {
- |source, request| "#{request.ssl? ? 'https' : 'http'}://d1f0ywl7f2vxwh.cloudfront.net/r-#{RELEASE_NUMBER}"
+ |source, request| "#{request.ssl? ? 'https' : 'http'}://d1f0ywl7f2vxwh.cloudfront.net/r-#{ENV['RELEASE_NUMBER']}"
}
# Disable delivery errors, bad email addresses will be ignored
6 config/facebooker.yml
View
@@ -11,6 +11,12 @@ staging:
api_key: xxx
callback_url: xxx
+production:
+ app_id: xxx
+ secret: xxx
+ api_key: xxx
+ callback_url: xxx
+
test:
app_id: xxx
secret: xxx
2  lib/tasks/daily.rake
View
@@ -77,7 +77,7 @@ namespace :update do
load 'bin/daily/daily_parse_people.rb'
}
else
- puts "nothing to update"
+ OCLogger.log "Legislator data file people.xml has not been updated since last parse. Skipping."
end
rescue Exception => e
if (['production', 'staging'].include?(Rails.env))
Please sign in to comment.
Something went wrong with that request. Please try again.