Skip to content

Instantly share code, notes, and snippets.

this is my controller:

module Admin
  class StatsController < Admin::BaseController
    def index
      @q = User.ransack(params[:q])
      @users = @q.result(distinct: true).page(params[:page]).per(params[:per] || DEFAULT_PER_PAGE)
    end
  end
end
  • Login to postgres:
    psql -U postgres (Mac OS)
    sudo -u postgres psql (Ubuntu)
  • List databases:
    psql -l
  • Create user and password:
    psql -U postgres -c "CREATE USER hien WITH PASSWORD '119201my'"
  • Show roles:
    select * from pg_roles;

Get rid of MAMP.

Server software should be installed by Homebrew.

Why did you use some strange SQL command to set the password for 'chatblazer' user?

delete the user. for mac, download SequelPro to help you manage MySQL.

then run this query.