why is it that every time I find a tutorial, there are errors in it so that it does not work and I end up learning nothing.
Honestly I don’t know how anybody learns these languages, cause to me there are no solid resources available.
Trying to do this tutorial http://guides.rubyonrails.org/getting_started.html#creating-posts
And I get stuck here on part 5.7 Showing Posts:
The first line says
post ``GET
/posts/``:id``(.``:format``) posts``#show
``
before this step I was editing the file app/controllers/posts_controller.rb
So I have to assume since no other file was mentioned that I add it there, correct, is it me? am I reading this wrong.
where do I add it, at the end, the beginning??
Here is what the class looks like now:
class PostsController < ApplicationController
def new
end
def create @post = Post.new(post_params)
@post.save redirect_to @post end
private def post_params params.require(:post).permit(:title, :text) end
end
Someone please help, I really would like to complete a tutorial.
This is the error from the server:
C:/Sites/blog/app/controllers/posts_controller.rb:2: syntax error, unexpected ':', expecting keyword_end
post GET /posts/:id(.:format) posts#show
^
Rails.root: C:/Sites/blog
Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"jDk9SBoDDxg/gaTMf7bckQ3uCFLhd9GX69Iy7dluc0M=",
"post"=>{"title"=>"Testing",
"text"=>"Hello World"},
"commit"=>"Save Post"}