Reputation: 65
i'm having some trouble with this code. Actually is pretty simple, but i can't find the problem. The page was working , but now i get this error.i was about to deploy it on heroku.i had just finished the destroy section on ruby
and/home/nitrous/code/rails_projects/alpha-blog/app/controllers/articles_controller.rb:2: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '(' before_action :set_article, only:[:edit, :update,:show,:destroy] ^.here's my code
class ArticlesController < ApplicationController>
before_action :set_article, only:[:edit, :update,:show,:destroy]
def new
@article =Article.new
end
def edit
end
def create
@article =Article.new(article_params)
[email protected]
flash[:notice] = "Article was successfully created"
redirect_to article_path(@article)
else
render 'new'
end
end
def update
[email protected]
flash[:notice] = "Article was successfully updated"
redirect_to article_path(@article)
else
render 'edit'
end
end
def show
end
def destroy
@article.destroy
flash[:notice]= "Article was successfully deleted"
redirect_to_articles_path
end
private
def set_article
@article = Article.find(params[:id])
end
def article_params
params.require(:article).permit(:title, :description)
end
end
Upvotes: 0
Views: 55
Reputation: 4604
Remove the >
after ApplicationController
class ArticlesController < ApplicationController
Upvotes: 1