Skip to content

Instantly share code, notes, and snippets.

View i-arindam's full-sized avatar

Arindam Chakraborty i-arindam

  • Bangalore, India
  • 12:37 (UTC +05:30)
View GitHub Profile
class User < ApplicationRecord
has_many :posts
has_many :comments
# id :integer not null, primary key
# name :string(50) default("")
end
@i-arindam
i-arindam / rspec_rails_cheetsheet.rb
Created May 29, 2017 05:51 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@i-arindam
i-arindam / Capfile
Created September 23, 2014 03:37
Setup files
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rails'
require 'rvm1/capistrano3'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
@i-arindam
i-arindam / .bash_profile
Last active May 6, 2020 08:56
Public .bash_profile
export GIT_MERGE_AUTOEDIT='no'
alias rdm='rake db:migrate'
alias migratefortests='bin/rails db:migrate RAILS_ENV=test'
# Utils
alias comcount='git shortlog -sn | grep -i arindam | cut -f 1 | paste -sd+ - | bc'
alias reload='source ~/.bash_profile'
alias editp='vim ~/.bash_profile'
alias gemcount='gem list | wc -l'
@i-arindam
i-arindam / Rails and ruby.md
Last active August 9, 2016 14:44 — forked from ryansobol/gist:5252653
Interview Questions
  1. to_param
  [ 1, 'String', true, String].to_param

"1/String/true/String"

  1. with_options
  class ModelName < AR::Base
    has_many :model1, dependent: :destroy
@i-arindam
i-arindam / A-Pen-by-Arindam-Chakraborty.markdown
Created December 22, 2013 10:10
A Pen by Arindam Chakraborty.
@keyframes spin{
0% { transform:rotate(0) scale(1) }
25% { transform:rotate(360deg) scale(.9) }
50% { transform:rotate(720deg) scale(.8) }
75% { transform:rotate(720deg) scale(.9) }
100% { transform:rotate(720deg) scale(1) }
}
@-moz-keyframes spin {
0% { -moz-transform:rotate(0) scale(1) }
25% { -moz-transform:rotate(360deg) scale(.9) }
@i-arindam
i-arindam / Gemfile
Created June 15, 2013 10:52
rails app setup steps
source 'https://rubygems.org'
source 'http://gems.github.com'
gem "bcrypt-ruby", :require => "bcrypt"
gem "cached_model", '1.3.1'
gem "capistrano", '2.15.4'
gem "daemons", '1.1.9'
gem 'debugger', '1.6.0'
gem 'delayed_job_active_record', '0.4.4'
gem 'hiredis', '0.4.5'
@i-arindam
i-arindam / git diff
Created February 27, 2013 18:51
active admin gem diff
diff --git a/Gemfile b/Gemfile
index df36647..2b8cb10 100644
--- a/Gemfile
+++ b/Gemfile
@@ -19,6 +19,9 @@ gem "rmagick", '2.13.1'
gem 'rvm-capistrano'
gem 'hiredis', '0.4.5'
gem 'redis', '3.0.2'
+gem 'activeadmin'
+ gem 'sass-rails'
@i-arindam
i-arindam / activeadmin_login_stacktrace
Created February 25, 2013 19:23
Stack trace for localhost:3000/admin after using activeadmin gem
Started GET "/admin" for 127.0.0.1 at 2013-02-26 00:48:33 +0530
ActionController::RoutingError (wrong constant name Admin/dashboardController):
activesupport (3.2.6) lib/active_support/inflector/methods.rb:229:in `const_defined?'
activesupport (3.2.6) lib/active_support/inflector/methods.rb:229:in `block in constantize'
activesupport (3.2.6) lib/active_support/inflector/methods.rb:228:in `each'
activesupport (3.2.6) lib/active_support/inflector/methods.rb:228:in `constantize'
activesupport (3.2.6) lib/active_support/dependencies.rb:554:in `get'
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:54:in `controller'