I'm new to Ruby on Rails, but has quite some experience in other OO programming.
Has got stuck though - it seems - when trying to create a simple blog application following this guide: http://guides.rubyonrails.org/getting_started.html
In point 5.7 (Showing Posts), the values from the form should be displayed on screen, but my display is just empty:
Title:
Text:
???
Would really appreciate any tips to where the error might be !
... don't know if the code below is sufficient to narrow it down, otherwise let me know of course.
Thank you very much for any help!
/Johan
My show.html.erb file is simply:
<p>
<strong>Title:</strong>
<%= @post.title %>
</p>
<p>
<strong>Text:</strong>
<%= @post.text %>
</p>
but seems that @post reference an empty object?
--
Here is my posts_controller.rb file:
class PostsController < ApplicationController def new end
def create
@post = Post.new(post_params[:post])
@post.save
#render text: params[:post].inspect
redirect_to @post
end
def show
@post = Post.find(params[:id])
end
private
def post_params
params.require(:post).permit(:title, :text)
end
end
(the render text: command displays the parameters correctly)
--