Ruby on Rails Thursday, September 26, 2013

Hi there.

I have a problem about accessing posts/show.html.erb

i can listing all posts on index.html.erb but when i try to access any
post html tags are not shown in show.html.erb, like images.

------------------
Controller

class PostsController < ApplicationController
before_action :postu_belirt, only: [:show, :edit, :update, :destroy]
http_basic_authenticate_with name: "esss", password: "birki"

def index
@posts = Post.all
end

def show
end
end

-----------------

index.html.erb

<% @posts.each do |post| %>
<%= link_to post.baslik, post, :class => "baslik"%>
<%= post.created_at.strftime("%d %b %y") %>
<%= post.created_at.strftime("%H:%M") %>
<%= raw post.text %>
<%- end %>
----------------------

show.html.erb

<%= @post.baslik %>
<%= @post.created_at.strftime("%d %b %y") %>
<%= @post.created_at.strftime("%H:%M") %>
<%= link_to 'Duzenle', edit_post_path(@post), :class => "genel" %>
<%= raw @post.text %>

Thanks.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/55f98079e18013eff1c2a9b8e1ec31ba%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment