Wednesday, April 18, 2012

undefined local variable or method `blog'?

I am working on a rails application and I have a Dashboard::user(dashboard/user) controller and I would like for users to update their blog post through the backend of the site. That works fine but when I am trying to get a list of the latest blog post a user has created I get an error.



dashboard/users_controller



def content
@blog = Blog.new
render ('content')
end


dashboard/blogs/_blog_list.html.erb



<%= div_for(:dashboard ,blog) do %>
<%= link_to image_tag(blog.preview.url(:thumb)), dashboard_blog_path(blog) %>
<h1><%= link_to (blog.title),dashboard_blog_path(blog) %></h1>
<p><%= truncate blog.excerpt, length: 160 %></p>
<%= blog.published_at %>
<%= blog.site_id %>
<% end %>


Any reason why this is not working?





No comments:

Post a Comment