Skip to content

Instantly share code, notes, and snippets.

@dre3s
Last active January 12, 2016 13:44
Show Gist options
  • Select an option

  • Save dre3s/d66aa89f34b9e6e0fd16 to your computer and use it in GitHub Desktop.

Select an option

Save dre3s/d66aa89f34b9e6e0fd16 to your computer and use it in GitHub Desktop.
rails.utils

#Rails Commands

http://guides.rubyonrails.org/command_line.html

##Creating new Project

New Project Sample

$ rails new project_name

New project with database mysql

  • -d = database
$ rails new project_name -d mysql

##Rails Generate

Rails Geneate Scaffold To create structure model

  • table name = User
  • columns name = password:string | email:string
$ rails generate scaffold User password:string email:string

##Rake

db:migrate to create database

$ rake db:migrate

Acessando console

$ rails console

Acessando models

$ rails console

Ex.: model(mongo) do prost

$irb> ProstVideo::Video.where(id: "560ea733c280770fde00d806").first

Retornando valor de um campo

$irb> ProstVideo::Video.where(id: "560ea733c280770fde00d806").first.video_url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment