Notes: basic psql commands

As I’m learning postgresql to develop with Heroku, here are my notes on some of the basic commands that are necessary to move around within the command-line interface.

Logging in under the postgres user (this would be like root in mysql)
psql -U postgres -h localhost

To list all databases:
\list

To connect to a database (similar to use database in mysql):
\c the_database

To list tables in that database:
\d

To list the columns in a particular table:
\d table_name

To view all rows in a given connected table (just the standard sql command):
select * from the_table

To quit out of the psql command-line utility:
\q

Notes: basic psql commands

A summary of linux user management tools

To add an existing user “frank” to an existing group “ssh”:

usermod -a -G ssh frank

To add new user “mike” to existing group “friends.”
usermod -g friends mike

To show all members in a group “people”:
sudo apt-get install members
members people

A summary of linux user management tools

Notes: Adding themes to rails app

To add themes to a rails app

  • Drop respective css and javascript files into appropriate directory under vendor/assets/.
    Note: Files should have unique name (I name them after the theme so flatty-theme/css/style.css simply becomes flatty.css.
  • Add the following code to your config/application.rb under # add custom validators path in the Application class

    config.assets.paths << "#{Rails.root}/vendor/assets/*"
    config.assets.paths << "#{Rails.root}/vendor/assets/fonts"
    config.assets.paths << "#{Rails.root}/vendor/assets/stylesheets"
  • Adjust whatever views you’re using to use the appropriate classes in your theme

…And that’s it!

Notes: Adding themes to rails app

How to Override and Customize the Devise Controller in Rails

Was an absolute lifesaver when I was trying to add additional registration information to my sign-up page.

How I Learned Ruby on Rails

Judging by the number of different StackOverflow questions, there are a lot of people trying to do this, and a lot of confusion. Here is how I did it, and hopefully it helps you.

I have a User and a Verifier model.  What I want to do is create a new Verifier every time I create a new user, and pass in the user.id for the User into the verifier.user_id so that they are mapped together.

In order to do this I want to not really override but add additional functionality to the existing devise controller that handles when new users are created (and destroyed).  So I need to access the RegistrationsController#Create function in devise.

First thing is to create a new folder in the ‘app/controllers‘ folder where we can put my custom controller.  I called mine ‘app/controllers/my_devise‘.  Then create a new file in this folder…

View original post 534 more words

How to Override and Customize the Devise Controller in Rails