Disable ActiveRecord for Rails 4

If you are creating a new application, you can use -O to skip ActiveRecord: rails new my_app -O For existing applications: 1. Remove database adapter gems from your Gemfile (mysql2, sqlite3, etc.) 2. Change your config/application.rb Remove require ‘rails/all line and require frameworks (among those available in your rails version, the list varies, do not … Read more

Nested attributes unpermitted parameters

Seems there is a change in handling of attribute protection and now you must whitelist params in the controller (instead of attr_accessible in the model) because the former optional gem strong_parameters became part of the Rails Core. This should look something like this: class PeopleController < ActionController::Base def create Person.create(person_params) end private def person_params params.require(:person).permit(:name, … Read more

Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?

run postgres -D /usr/local/var/postgres and you should see something like: FATAL: lock file “postmaster.pid” already exists HINT: Is another postmaster (PID 379) running in data directory “/usr/local/var/postgres”? Then run kill -9 PID in HINT And you should be good to go.

Rails Observer Alternatives for 4.0

Take a look at Concerns Create a folder in your models directory called concerns. Add a module there: module MyConcernModule extend ActiveSupport::Concern included do after_save :do_something end def do_something … end end Next, include that in the models you wish to run the after_save in: class MyModel < ActiveRecord::Base include MyConcernModule end Depending on what … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)