From 35e30a3d89344aa2b4d39126e24cb992281bb774 Mon Sep 17 00:00:00 2001 From: Gabriel Cebrian Date: Wed, 13 Feb 2013 18:28:47 -0800 Subject: [PATCH 1/3] Added dummy deleted user to be used when a message associated with a user that has been deleted is shown --- app/controllers/channels_controller.rb | 2 +- app/models/activity.rb | 4 ++++ app/models/user.rb | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index 7310e2e7..a4743f0d 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -12,7 +12,7 @@ def index more_activities = (channel.activities.count > Kandan::Config.options[:per_page]) channel.activities.order('id DESC').includes(:user).page.each do |activity| activities.push activity.attributes.merge({ - :user => activity.user.as_json(:only => [:id, :ido_id, :email, :first_name, :last_name, :gravatar_hash, :active, :locale]) + :user => activity.user_or_deleted_user.as_json(:only => [:id, :ido_id, :email, :first_name, :last_name, :gravatar_hash, :active, :locale, :username]) }) end diff --git a/app/models/activity.rb b/app/models/activity.rb index 0f29a94b..a96fdb9e 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -3,4 +3,8 @@ class Activity < ActiveRecord::Base belongs_to :channel paginates_per Kandan::Config.options[:per_page] + + def user_or_deleted_user + self.user || User.deleted_user + end end diff --git a/app/models/user.rb b/app/models/user.rb index a40df435..0fab6559 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -26,4 +26,11 @@ def active_for_authentication? super && active? end + def self.deleted_user + dummy_user = new(:username => "Deleted User", :gravatar_hash => "", :email => "") + dummy_user.active = false + + return dummy_user + end + end From bf0f81d7c83dc7d040f30036f95ce6afc63cd6c6 Mon Sep 17 00:00:00 2001 From: Gabriel Cebrian Date: Wed, 13 Feb 2013 18:31:08 -0800 Subject: [PATCH 2/3] Added logger to development env for Thin server --- config/environments/development.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index d6ef2dae..ed1a4963 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,4 +34,10 @@ # Expands the lines which load the assets config.assets.debug = true + + config.logger = Logger.new(STDOUT) + config.logger.level = Logger.const_get( + ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'DEBUG' + ) + end From 025dca931a55a5614f28f6ee13829933317c971f Mon Sep 17 00:00:00 2001 From: Tim Poulsen Date: Thu, 14 Feb 2013 16:40:08 -0500 Subject: [PATCH 3/3] Added AppFog installation instructions --- DEPLOY.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/DEPLOY.md b/DEPLOY.md index 255ee002..d7c0f1eb 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -62,6 +62,45 @@ Your app should be up and running now. The default admin user is `Admin` with pa ## dotCloud Looking for community help here. +## AppFog +You'll need an [AppFog account](https://www.appfog.com/) and the [af command line tool](https://docs.appfog.com/getting-started/af-cli) installed. Once that's all set up, login from the command line: `af login`. You'll be prompted for the username/password you set on AppFog. You're returned to your operating system's command prompt. It's not a terminal emulator. + +If you want to use PostgreSQL rather than MySQL, provision the service on the Services page of the [console](https://console.appfog.com). Note the name of your database and app name on the console and substitute as appropriate. + + git clone https://github.com/kandanapp/kandan.git + cd kandan + bundle install + bundle exec rake assets:precompile + af push your_app_name --path . --instances 1 --mem 256M --runtime ruby19 + +You'll answer a few questions; you'll probably get an error at the end about an invalid app description. That's okay, we'll fix that next: + + Detected a Rails Application, is this correct? [Yn]: y + 1: AWS US East - Virginia + 2: AWS EU West - Ireland + 3: AWS Asia SE - Singapore + 4: Rackspace AZ 1 - Dallas + 5: HP AZ 2 - Las Vegas + Select Infrastructure: 1 + Application Deployed URL [.aws.af.cm]: + Memory reservation (128M, 256M, 512M, 1G, 2G) [256M]: + How many instances? [1]: + Bind existing services to ''? [yN]: y + 1: kandan_production + 2: -mysql-12781 + Which one?: 1 + Bind another? [yN]: n + Create services to bind to ''? [yN]: + Would you like to save this configuration? [yN]: y + Manifest written to manifest.yml. + Creating Application: Error 300: Invalid application description + +If you get the invalid app description, open manifest.yml in a text editor and remove the space from the description. (It defaults to Rails Application, which causes the error.) Then, at the terminal: + + af update + +And you should also restart the app on AppFog (in the console). Then, Kandan should be available on your AppFox backend now! With your browser, visit the domain name assigned to you by AppFog (or create a CNAME record at your DNS provider to use an alternate). + ## Heroic server install If you're looking to install Kandan on a private server, or to develop locally for lemonodor fame, then here is the path you must follow, young hero: