Skip to content

Instantly share code, notes, and snippets.

@abitrolly
Last active March 8, 2021 18:53
Show Gist options
  • Save abitrolly/20778a77ba6ab98ea37767f12b2c57e2 to your computer and use it in GitHub Desktop.
Save abitrolly/20778a77ba6ab98ea37767f12b2c57e2 to your computer and use it in GitHub Desktop.
Experience patching Ruby on Rails project

in Ruby all access to object attributes is thru methods

  • there is no direct way like obj.field in Python

in Ruby method calls may have no ()

  • obj.method is the same as obj.method()

# get all application routes
rake routes

# get all application routes on Heroku
heroku run rake routes

# list all rake tasks
heroku run rake -T
# work with objects from command line
$ heroku run console --sandbox
irb(main):001:0> User.count


linking to objects on views has a lot of helpers https://guides.rubyonrails.org/routing.html#path-and-url-helpers which is bad, because now there is not universal grep to find all the links.

links useful to construct the reliable search query for finding all references to certain objects with link_to, link_to_if etc.

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