When are symbols used in Rails?

Viewed 1548

I assume alot of these are built in or convetions, but methods like belongs_to or require uses a symbol for the model name it takes as an argument.

And when it comes to methods like before_action, I'm not sure why there is a symbol in front of the controller actions as in the brackets below.

before_action :find_course, only: [:show, :edit, :update, :destroy]

Are all of these symbols used as a key of a hash or do most methods take symbols as its arguments?

2 Answers
Related