Skip to content

Instantly share code, notes, and snippets.

View prathamesh-sonpatki's full-sized avatar
🏠
Working from home

प्रथमेश Sonpatki prathamesh-sonpatki

🏠
Working from home
View GitHub Profile
@prathamesh-sonpatki
prathamesh-sonpatki / gist:1229657
Created September 20, 2011 16:59
Heroku pg eror
root@spandan:/opt/Rails-project-For-Student-Forum# heroku run rake db:migrate
Running rake db:migrate attached to terminal... up, run.5
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (can't activate pg (~> 0.11, runtime), already activated pg-0.10.0. Make sure all dependencies are added to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
root@spandan:/opt/Rails-project-For-Student-Forum#
How to Solve this error ?
@prathamesh-sonpatki
prathamesh-sonpatki / y2g.rb
Created June 29, 2012 11:36
Program to convert yacc files to grammar files (.y to to .grammar)(Incomplete)(Section#1 and Section#2 are completed, Working on Section# 3)
def match_package(str)
str.match /package\s.*;/
end
def match_import(str)
str.match /import\s.*;/
end
def match_class(str)
@prathamesh-sonpatki
prathamesh-sonpatki / y2g.rb
Created July 20, 2012 07:41
script to convert .y to .grammar
def match_package(str)
str.match(/package\s.*;/)
end
def match_import(str)
str.match(/import\s.*;/)
end
def match_class(str)
str.match(/class\s*[A-Z]\w*/)
## Authorizations
# Uncomment out the merging for each enviornment that you'd like to include.
# You can also just copy and paste the tree (do not include the "authorizations") to each
# enviornment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
group_base: dc=corp, dc=xyz, dc=net
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
required_groups:
## Authorizations
# Uncomment out the merging for each enviornment that you'd like to include.
# You can also just copy and paste the tree (do not include the "authorizations") to each
# enviornment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
group_base: dc=corp, dc=xyz, dc=net
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
required_groups:
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> LDAP Configuration
config.ldap_logger = true
config.ldap_create_user = true
# config.ldap_update_password = true
#config.ldap_config = "#{Rails.root}/config/ldap.yml"
config.ldap_check_group_membership = true
# config.ldap_check_attributes = false
until STDIN.eof?
puts gets.scan(/\w+/).length
end
## Authorizations
# Uncomment out the merging for each enviornment that you'd like to include.
# You can also just copy and paste the tree (do not include the "authorizations") to each
# enviornment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
#group_base: dc=corp, dc=betterlabs, dc=net
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
#required_groups:
@prathamesh-sonpatki
prathamesh-sonpatki / devise.rb
Created October 16, 2012 14:21
devise.rb and error
# Devise.rb
Devise.setup do |config|
# ==> LDAP Configuration
config.ldap_logger = true
config.ldap_create_user = true
#config.ldap_update_password = true
#config.ldap_config = "#{Rails.root}/config/ldap.yml"
#config.ldap_check_group_membership = true
config.ldap_check_attributes = true
config.ldap_use_admin_to_bind = true
@prathamesh-sonpatki
prathamesh-sonpatki / email.rb
Last active December 11, 2015 05:48
Shoulda-matchers validation error
class Email < ActiveRecord::Base
scope :by_account, -> account_id { where(account_id: account_id) }
attr_accessible :template_name, :subject, :content, :user_id, :account_id
validates :subject, presence: true
validates :template_name, presence: true
validates :template_name, uniqueness: { :scope => :account_id }
validates :content, presence: true