I keep getting these errors:
/Users/macowner/workspace/blog/app/controllers/articles_controller.rb:3: syntax error, unexpected tIVAR, expecting keyword_end end @article = Article.all ^ /Users/macowner/workspace/blog/app/controllers/articles_controller.rb:7: syntax error, unexpected keyword_end, expecting ')' /Users/macowner/workspace/blog/app/controllers/articles_controller.rb:28: syntax error, unexpected end-of-input, expecting keyword_end
I know it has to be something simple in my syntax:
class ArticlesController < ApplicationController def index end @article = Article.all
def show
@article = Article.find(params(:id)
end
def new
@article = Article.new
end
def create
@article = Article.new(article_params)
if @article.save
redirect_to @article
else render 'new'
end
private
def article_params
params.require(:article).permit(:title, :text)
end
Aucun commentaire:
Enregistrer un commentaire