After log in should redirect to a page other than default root

11/16/14  Public, Rails General, Gems

When using Devise, when a registered user logs in, they are, by default, directed to the root.

Here is the code to change this to being directed to a page of your choosing

In `app/controllers/appl...

1 vote - harrylevine

Create records directly in the database through the rails console

11/15/14  Public, Rails General

In the Rails Console:

First method
1. instantiate an object - $ subject = Subject.new
2. set a value - $ subject.name = “John”
3. save the object to the database - $ subject.save

Second method
1. use the cr...

1 vote - plawler

Rails database column migration methods

11/15/14  Public, Databases, Rails General

add_column(table, column, type, options)
remove_column(table, column)
rename_column(table, column, new_name)
change_column(table, column, type, options)

1 vote - brookemcg

Two Rails syntax methods for creating a table with columns in the database

11/15/14  Public, Rails General

Full syntax method. Used when adding a one-off column

create_table "table" do |t|
  t.column "name", :type, options
end

Shortened syntax method. More common.

create_table "table" do |t|
  t.type "name", options...

1 vote - brookemcg

Command for seeing all available rake tasks

11/15/14  Public, Command Line

$ rake -T

To see just the rake database related tasks:

$ rake -T db

1 vote - brookemcg

How to log into MySQL in the terminal

11/15/14  Public, Command Line, Databases

$ mysql -u root -p
$ enter in your password

Here is how to log into a MySQL database as a specific user, connecting to a named, specific database, with a password

In this example, the name of the user is simple_cms2
and the name of...

1 vote - plawler

Coloring the tab of an un-saved file in Sublime text

11/15/14  Public, Tricks

This will make the tab's text orange whenever there are unsaved changes to a file.

  1. From the Preferences, select Settings-User
  2. Add in this line: "highlight_modified_tabs": true,

http://stackoverflow.com/questions/11294620...

1 vote - brookemcg

Expand and collapse folder tree in Sublime

11/15/14  Public, Shortcuts

Hold down the Option Key + mouse click on folder

Holding down Option key while clicking a folder allows you to expand/collapse the entire tree of that folder.

https://coderwall.com/p/q1o-da

1 vote - brookemcg

Tip for proofreading code

11/15/14  Public, Tricks

  • Go through a file and review each line going backward.
  • Start at the last line, and check each word in reverse against what you should have typed.
  • It's a trick to make your brain not attach meaning to each part of the code, and doing that...

1 vote - plawler

Command for starting an IRB simple prompt session

11/15/14  Public, Command Line

Into the command line type $ irb --simple-prompt

1 vote - brookemcg