Skip to content

Instantly share code, notes, and snippets.

@mathifonseca
Last active October 17, 2017 17:04
Show Gist options
  • Save mathifonseca/2335f7a784c2486e7d6a15f86b6340f1 to your computer and use it in GitHub Desktop.
Save mathifonseca/2335f7a784c2486e7d6a15f86b6340f1 to your computer and use it in GitHub Desktop.
Intro to Rails
#crear app
rails new rottenpotatoes
cd rottenpotatoes
tree
#agregar haml a Gemfile
https://gist.github.com/e858c6b1ba260e9b0ecccdebd64cb2d7
bundle install
#mirar routes vacias
bundle exec rake routes
#iniciar server
rails server
#ir a /movies y ver error
#mirar log en log/development.log
#crear routes
https://gist.github.com/armandofox/294ff740da2b016784c8
bundle exec rake routes
#ir a /movies y ver error
#ir a / y ver redirect
#mirar sqlite y agregar datasource a rubymine
#mirar config/database.yml
#crear migration para movies
rails generate migration create_movies
#mirar nuevo archivo en db/migrate
https://gist.github.com/cd0bc6647751700aff9c166b88a7a871
rake db:migrate
#crear app/models/movie.rb
https://gist.github.com/armandofox/086f64209a9bfc568b39e1956f296e53
rails console
#jugar con Movie
https://gist.github.com/armandofox/815530cfaf9b20848c3672360d0436f2
#probar find_by*
#editar db/seeds.rb
https://gist.github.com/armandofox/056aae02801cf42a0199
rake db:seed
#crear app/controllers/movies_controller.rb
https://gist.github.com/armandofox/48166d24b94b504e6453
#crear app/views/movies/index.html.haml
https://gist.github.com/armandofox/582dc3967815a1f708da
#editar app/views/layouts/application.html.erb
https://gist.github.com/armandofox/8478137df254b44cead4
#crear show en controller
https://gist.github.com/armandofox/ac6dc92fdddc42d96689
#crear app/views/movies/show.html.haml
https://gist.github.com/armandofox/216ab745dc38f6a68b3d
#poner css en app/assets/stylesheets/application.css
https://gist.github.com/armandofox/3822f74516236abc0cfa
#probar debugger
#probar logger
#probar raise params.inspect
#probar = @movie.inspect
#agregar al index.html
https://gist.github.com/armandofox/3c860b07425a97e5f089
#agregar al controller
https://gist.github.com/armandofox/746181f6684fe6ed0518151b530b55bd
#agregar view de new
https://gist.github.com/armandofox/acb276aefb62630a0b28
#agregar create
https://gist.github.com/armandofox/31df42db993018a83be8e3c64ba7dcb7
#agregar redirect a index
https://gist.github.com/armandofox/f4a1a5ce317352127d34
#agregar mensaje en flash
https://gist.github.com/armandofox/832e80e008d827f12aba
#editar default layout
https://gist.github.com/armandofox/eb5c11f870f407697a12
#considerar session[]
#editar view de show
https://gist.github.com/armandofox/f439444b659058678f79
#agregar view de edit
https://gist.github.com/armandofox/df5ab3a1654e60f85c44
#agregar edit y update en controller
https://gist.github.com/armandofox/60a85a64799ea238c045
#agregar destroy en controller
https://gist.github.com/armandofox/88956c30e536f99a31cf
#agregar destroy en view
https://gist.github.com/armandofox/eb9e552ed2366f308b38
#responder a distintos formatos
https://gist.github.com/armandofox/9497a84089e6ca247398
#Chapter 5
#mover partes comunes de new y edit a un partial
https://gist.github.com/armandofox/1bf946bc8f34d058ac5d
https://gist.github.com/armandofox/ad0c65d300d601f1051a
https://gist.github.com/armandofox/dae7562c654a63782c7e
#constraints
https://gist.github.com/armandofox/5fe0661f35b583d5f23b6ffeb7313aee
https://gist.github.com/armandofox/298eb16fe86a9e693151
https://gist.github.com/armandofox/5b3f9c5cb39cb0794be1
#foto de hooks en el lifecycle en el libro
#hooks en models / lifecycle callbacks
https://gist.github.com/armandofox/36244812a627fba97a69
#hooks en controllers / filters
https://gist.github.com/armandofox/7fc62966ca718d06da58a532f8aa9f58
https://gist.github.com/armandofox/f8850b42163f914d3e4e
#OmniAuth
#model relations
https://gist.github.com/armandofox/09844ff76567b12a9e9b1299888e49e6
https://gist.github.com/armandofox/a13683e79aa4a412004b775c8dbe399b
https://gist.github.com/armandofox/fc189ed81e4de4b5ea56
https://gist.github.com/armandofox/c503db319f16abdee53fb3af521eec62
https://gist.github.com/armandofox/33c413b1c7133293a7901ee4a8285b00
https://gist.github.com/9d6c4b33ef865216590e
#routes for associations
https://gist.github.com/armandofox/fab70d71077eb52ec516
https://gist.github.com/armandofox/dc7c5955334680ba04cc563c8cee8a5d
https://gist.github.com/armandofox/72851f6d510870466bfc
#queries
https://gist.github.com/armandofox/bee1c621e77d4ae61662
https://gist.github.com/armandofox/6c399b86201d40b5e3c2
#testing
agregar rspec al gemfile
rails generate rspec:install
ver carpeta spec
https://gist.github.com/769b81a80f9e8d7dd4e8bfc838d3a275
agregar guard al gemfile
bundle exec guard init -> ver guardfile
bundle exec guard
https://gist.github.com/armandofox/f08084be00fa6d3996221149326a454b
https://gist.github.com/d9181fe0bac3a29540a84c8076176025
https://gist.github.com/armandofox/8fd0a78070a5b98f48b9
https://gist.github.com/191bf02a919106dc6126cecbcb55c3bd
https://gist.github.com/25f02d255b4d8f1fed0ef6ff0a08a211
https://gist.github.com/244af8fd30328adac81ec7c1c41d915b
fixtures/factories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment