Rails General

This is why you’re here, ain’t it? Then don’t forget this, that and the other thing.
You’ve probably been told that Ruby is a language and Rails is a framework, but truly appreciating that distinction takes time. As you progress you will sharpen your interpretation of what makes Rails, Rails. And as you become more aware of how you can leverage Rails to accomplish a given task, you will want to remember how to do it again in the future. This stack is dedicated to capturing these types of Rails framework revelations. Things that might be found in a Rails guide, if you were the author.

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

Shortened syntax method. More common.

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

1 vote - brookemcg

Determine what gems in your project have newer versions available

11/08/14  Public, Rails General, Gems

Run bundle outdated

To help decide if you want to take action and update a particular gem, view the gem's changelog.

For example, if there is an updated version of Devise available, Google devise changelog to determine what has been ch...

1 vote - harrylevine