user2968505 user2968505 - 29 days ago 20
Ruby Question

Rails before action syntax error

before_action :set_article, only: [:show, :edit, :update, :destroy], :classify_article, only: [:create]


Why am i getting a syntax error here, it happened after after i added the classify_article function

Answer

You should have a separate line for each before action:

before_action :set_article, only: [:show, :edit, :update, :destroy]
before_action :classify_article, only: [:create]