Blog Archives

Invalid mix of scope block and deprecated finder options on ActiveRecord association

While upgrading from rails to rails 4.2.6 has_many :subitems, through: :child_associations, source: :child, source_type: ‘ContentItem’, conditions: ‘content_items.deleted 1’, order: ‘content_associations.position ASC’ Replaced conditions with proc has_many :subitems, ->{where(‘content_items.deleted 1’)}, through: :child_associations, source: :child, source_type: ‘ContentItem’,  order: ‘content_associations.position ASC’ 2.

Posted in Uncategorized, upgrade from rails 3 to 4

Heroku permission denied for database “postgres”

FATAL: permission denied for database “postgres” DETAIL: User does not have CONNECT privilege. Run this command to solve this error: heroku addons | grep POSTGRES

Tagged with: , ,
Posted in Heroku, Uncategorized

Create and integrate SSL certificate in Rails app Using [ Godaddy + Nginx(1.8) + Puma + Ubuntu Server(14.04 LTS) ]

Login to your server by ssh and then: Create file YOUR_RAILS_APP_DIRECTORY/config/puma.rb Below is puma.rb file content: #!/usr/bin/env puma directory ‘/home/ubuntu/YOUR_RAILS_APP_DIRECTORY/public/’ rackup ‘/home/ubuntu/YOUR_RAILS_APP_DIRECTORY/’ environment ‘production’ daemonize true pidfile ‘/home/ubuntu/YOUR_RAILS_APP_DIRECTORY/tmp/pids/’ state_path ‘/home/ubuntu/YOUR_RAILS_APP_DIRECTORY/tmp/pids/puma.state’ stdout_redirect ‘/home/ubuntu/YOUR_RAILS_APP_DIRECTORY/log/puma.log’ threads 2, 5 bind ‘unix:///home/ubuntu/YOUR_RAILS_APP_DIRECTORY/tmp/sockets/puma.sock’ workers 2 Generate

Tagged with: , , ,
Posted in amazon, DNS, Godaddy, Nginx, production, Puma, Ruby on Rails, Ubuntu

Rails production environment assets loading

In Gemfile add: gem ‘rails_12factor’ In config/environments/production.rb add config.assets.compile = false #To stop run time assets precompile in production. config.assets.digest = true #To access assets which are precompiled and in their names have appendend digets by rails config.cache_classes = true

Tagged with: ,
Posted in production, Ruby on Rails

rbenv install 2.2.1 ruby not working

After running this command: rbenv install 2.2.1 Faced error below: Installing ruby-2.2.1… BUILD FAILED (Ubuntu 14.04 using ruby-build 20150928-2-g717a54c) Inspect or clean up the working tree at /tmp/ruby-buil Install ‘libffi-dev’ package using command below, then above command will work: sudo

Posted in missing liberaries, Ruby on Rails, Ubuntu

User does not respond to ‘devise’ method

In config/initializers/devise.rb Replace this: require ‘devise/orm/active_record’ with this: require ‘devise/orm/mongoid’ Replace content inside block: Devise.setup do |config| … require ‘devise/orm/mongoid’ … end

Posted in Devise, mongoid

TypeError (wrong argument type Class (expected Module)) | Problem when upgrading from rails 2 to rails 3 (and also ruby version)

TypeError (wrong argument type Class (expected Module)): actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `include’ actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `block in add_template_helper’ actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `module_eval’ actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `add_template_helper’ actionpack (3.0.10) lib/abstract_controller/helpers.rb:98:in `block in helper’ actionpack (3.0.10) lib/abstract_controller/helpers.rb:97:in `each’ actionpack (3.0.10) lib/abstract_controller/helpers.rb:97:in `helper’ actionpack

Tagged with: ,
Posted in Ruby on Rails

Attachment_fu plugin to Paperclip migration

While upgrading your Rails application from rails 2 to newer versions. You need to update Attachment_fu and replace it with some Gem, So if you want to switch to Paperclip this is right place Replace Attachment_fu with Paperclip. Detailed Link

Tagged with: , , , ,
Posted in upgrade from rails 2 to 3

redis integeration in heroku

Follow all steps given here: Explanation of some steps: heroku config –app heroku-app-name | grep REDISTOGO_URL output: REDISTOGO_URL: redis://user-name:password@redis-server:11247/

Posted in Heroku, Ruby on Rails

Diffrence between path and url routes helper rails [For Beginners]

Difference between path and url routes helper rails about_path -> ‘/about’ about_url -> ‘http://localhost:3000/about’ Note that about_url is the full URL http://localhost:3000/about (with localhost:3000 being replaced with the domain name, such as, for a fully deployed site). To get

Tagged with: , ,
Posted in Ruby on Rails