Can’t find the ‘libpq-fe.h header when trying to install pg gem

It looks like in Ubuntu that header is part of the libpq-dev package (at least in the following Ubuntu versions: 11.04 (Natty Narwhal), 10.04 (Lucid Lynx), 11.10 (Oneiric Ocelot), 12.04 (Precise Pangolin), 14.04 (Trusty Tahr) and 18.04 (Bionic Beaver)): … /usr/include/postgresql/libpq-fe.h … So try installing libpq-dev or its equivalent for your OS: For Ubuntu/Debian systems: … Read more

Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails

The problem is still your pg_hba.conf file*. This line: local all postgres peer Should be: local all postgres md5 After altering this file, don’t forget to restart your PostgreSQL server. If you’re on Linux, that would be sudo service postgresql restart. Locating hba.conf Note that the location of this file isn’t very consistent. You can … Read more

How do I get the current absolute URL in Ruby on Rails?

For Rails 3.2 or Rails 4+ You should use request.original_url to get the current URL. Source code on current repo found here. This method is documented at original_url method, but if you’re curious, the implementation is: def original_url base_url + original_fullpath end For Rails 3: You can write “#{request.protocol}#{request.host_with_port}#{request.fullpath}”, since request.url is now deprecated. For … Read more

Why do people use Heroku when AWS is present? What distinguishes Heroku from AWS? [closed]

First things first, AWS and Heroku are different things. AWS offer Infrastructure as a Service (IaaS) whereas Heroku offer a Platform as a Service (PaaS). What’s the difference? Very approximately, IaaS gives you components you need in order to build things on top of it; PaaS gives you an environment where you just push code … Read more

How can I rename a database column in a Ruby on Rails migration?

rename_column :table, :old_column, :new_column You’ll probably want to create a separate migration to do this. (Rename FixColumnName as you will.): script/generate migration FixColumnName # creates db/migrate/xxxxxxxxxx_fix_column_name.rb Then edit the migration to do your will: # db/migrate/xxxxxxxxxx_fix_column_name.rb class FixColumnName < ActiveRecord::Migration def self.up rename_column :table_name, :old_column, :new_column end def self.down # rename back if you need … Read more