user2968505 user2968505 - 1 year ago 104
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 Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download