Skip to content

Instantly share code, notes, and snippets.

@krishnasrihari
krishnasrihari / refactor.rb
Created November 23, 2012 03:36
Refactor the code
# Please refactor following code.
# Please post your answer as a private gist. A private gist is a gist which anyone can access but in order to access one needs to know the u
# of the gist .
#
# I something is not clear then make a judgement and move forward. No need to ask a question to get clarification. This is
# just to speed things up.
#
# Controller
class People < ActionController::Base
@krishnasrihari
krishnasrihari / gist:4154308
Created November 27, 2012 13:49
ActiveAdmin issue
Started GET "/admin/admin_users" for 192.168.0.100 at 2012-11-27 19:17:31 +0530
Processing by Admin::AdminUsersController#index as HTML
FB auth token is
device token is
AdminUser Load (1.7ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 LIMIT 1
(1.7ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "admin_users" LIMIT 30 OFFSET 0) subquery_for_count
(1.0ms) SELECT COUNT(*) FROM "admin_users"
CACHE (0.0ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "admin_users" LIMIT 30 OFFSET 0) subquery_for_count
AdminUser Load (1.6ms) SELECT "admin_users".* FROM "admin_users" ORDER BY "admin_users"."id" desc LIMIT 30 OFFSET 0
Rendered /home/krishna/.rvm/gems/ruby-1.9.3-p194@ferrotec-trail/gems/activeadmin-0.5.0/app/views/active_admin/resource/index.html.arb (932.2ms)
@krishnasrihari
krishnasrihari / unauthorzied401
Created December 9, 2012 08:18
Unauthorized 401 active admin
.........................................................................
For admin/login
.........................................................................
Started GET "/admin" for 192.168.0.101 at 2012-12-09 13:35:53 +0530
Processing by Admin::DashboardController#index as HTML
Completed 401 Unauthorized in 15ms
Started GET "/admin/login" for 192.168.0.101 at 2012-12-09 13:35:53 +0530
@krishnasrihari
krishnasrihari / new
Created December 9, 2012 16:40
Users/new issue
Encoding::CompatibilityError in Users#new
Showing /home/krishna/oDesk/yutongo/app/views/users/new.html.haml where line # raised:
incompatible character encodings: UTF-8 and ASCII-8BIT
Extracted source (around line #):
Rails.root: /home/krishna/oDesk/yutongo
Application Trace | Framework Trace | Full Trace
@krishnasrihari
krishnasrihari / gist:4370433
Created December 24, 2012 19:24
Postgresql error
krishna@krishna-desktop:~/oDesk/Rabble$ rake --trace db:migrate
Sass is in the process of being separated from Haml,
and will no longer be bundled at all in Haml 3.2.0.
Please install the 'sass' gem if you want to use Sass.
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
PG::Error: ERROR: relation "events" does not exist
@krishnasrihari
krishnasrihari / gist:4482692
Created January 8, 2013 10:18
Error: Processing by AccountsController#public as HTML
Rendered projects/_expand_ideation_processes_list.html.haml (15.7ms)
Rendered projects/_project.html.haml (159.9ms)
Rendered projects/_projects.html.haml (167.7ms)
Rendered accounts/public.html.haml within layouts/yutongo (170.0ms)
Completed 500 Internal Server Error in 174ms
ActionView::Template::Error (undefined method `html_safe' for nil:NilClass):
46: %a.toggle-play-process.btn.red-button.shadow-btn{:href => play_ideation_process_path(ideation_process)}= t(".play", :default => "Play")
47: - else
48: = show_invite_button(ideation_process, :class => "btn red-button shadow-btn", :start_label => "Start").html_safe
@krishnasrihari
krishnasrihari / gist:4617584
Created January 24, 2013 04:17
mails created without sender details
Started GET "/dashboard" for 178.197.234.53 at 2013-01-23 17:47:25 +0100
Processing by DashboardsController#show as HTML
Account Load (0.4ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'staging' LIMIT 1
CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'staging' LIMIT 1
User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 4 LIMIT 1
(0.2ms) BEGIN
(0.3ms) UPDATE `users` SET `last_request_at` = '2013-01-23 16:47:25', `perishable_token` = 'JFEnM9DZym6m2bseqjU', `updated_at` = '2013-01-23 16:47:25' WHERE `users`.`id` = 4
(2.0ms) COMMIT
Image Load (0.3ms) SELECT `images`.* FROM `images` WHERE `images`.`imageable_id` = 4 AND `images`.`imageable_type` = 'User' LIMIT 1
Idea Load (1.3ms) SELECT `ideas`.* FROM `ideas` WHERE `ideas`.`user_id` = 4 AND `ideas`.`idea_type` = 'fragment' ORDER BY created_at DESC
@krishnasrihari
krishnasrihari / gist:4976772
Created February 18, 2013 11:36
Rake migrate error for setup yutongo app
krishna@ubuntu:~/oDesk/yutongo$ rake db:setup
rake/gempackagetask is deprecated. Use rubygems/package_task instead
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /home/krishna/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/krishna/.rvm/gems/ruby-1.9.3-p194/gems/hoe-1.1.7/lib/hoe.rb:95: Use RbConfig instead of obsolete and deprecated Config.
yutongo_test already exists
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
-- create_table("accounts", {:force=>true})
-> 0.2307s
-- add_index("accounts", ["subdomain"], {:name=>"index_accounts_on_subdomain", :unique=>true})
@krishnasrihari
krishnasrihari / gist:5812392
Created June 19, 2013 07:47
broadcast user issue
Started PUT "/projects/2" for 178.197.226.20 at 2013-06-19 07:26:50 +0200
Processing by ProjectsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"4SmMGCDu8jwZ06bZw52oQ1N1+R8D9t6jZPTGPlYbSsw=", "project"=>{"ideation_processes_attributes"=>{"0"=>{"name"=>"idea creation", "start_date"=>"22-02-2013", "start_time"=>"03:00", "end_date"=>"21-06-2013", "end_time"=>"10:00", "status"=>"1", "ideation_tasks_attributes"=>{"0"=>{"position"=>"1", "id"=>"147", "tool_id"=>"1", "question_id"=>"8", "time"=>"120"}, "2"=>{"position"=>"3", "id"=>"187", "tool_id"=>"4", "question_id"=>"86", "time"=>""}, "1"=>{"position"=>"2", "id"=>"185", "tool_id"=>"4", "question_id"=>"8", "time"=>""}, "3"=>{"position"=>"4", "id"=>"186", "tool_id"=>"8", "question_id"=>"9", "time"=>""}, "4"=>{"position"=>"5", "id"=>"188", "tool_id"=>"4", "question_id"=>"87", "time"=>""}, "5"=>{"position"=>"6", "id"=>"189", "tool_id"=>"4", "question_id"=>"88", "time"=>""}, "6"=>{"position"=>"7", "id"=>"190", "tool_id"=>"4", "question_id"=
@krishnasrihari
krishnasrihari / gist:5966690
Created July 10, 2013 14:19
yutongo - issue
Started GET "/admin_users/sign_in" for 91.64.81.67 at 2013-07-10 14:48:34 +0200
Processing by Devise::SessionsController#new as HTML
Account Load (0.7ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'staging' AND (accounts.deleted_at IS NULL) LIMIT 1
CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'staging' AND (accounts.deleted_at IS NULL) LIMIT 1
Rendered /home/user17/.bundle/ruby/1.9.1/gems/devise-2.2.3/app/views/devise/shared/_links.erb (1.2ms)
Rendered /home/user17/.bundle/ruby/1.9.1/gems/devise-2.2.3/app/views/devise/sessions/new.html.erb within layouts/yutongo (6.8ms)
User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 20 AND (users.deleted_at IS NULL) LIMIT 1
(0.2ms) BEGIN
(0.5ms) UPDATE `users` SET `last_request_at` = '2013-07-10 12:48:35', `perishable_token` = 'D2OEgm7Hy68qNeFOCf', `updated_at` = '2013-07-10 12:48:35' WHERE `users`.`id` = 20
(9.4ms) COMMIT