I am struggling with a strange effect when using two partials
This is show.html.erb
posts commented on by <%= @user.login %>
<%= render :partial => @posts_commented_on %>
Posts submitted by <%= @user.login %>
<%= render :partial => @posts_submitted %>
This is the relevant bit of users.html.erb
<%= yield %>
This is from users_controller.rb
def show
@user = User.find(params[:id])
@posts_submitted = @user.posts.find(:all,
:limit => 6, :order => ‘posts.id DESC’)
@posts_commented_on = @user.posts_commented_on.find(:all,
:limit => 2, :order => ‘comments.id DESC’)
end
Can anybody tell me where the div, that splits submitted from comments,
appears from?
On May 16, 6:09 pm, Neil B. [email protected] wrote:
Can anybody tell me where the div, that splits submitted from comments,
appears from?
What does the post partial & generated html look like ? Could you have
forgotten to close a tag or something like that ?
Fred
Frederick C. wrote:
On May 16, 6:09�pm, Neil B. [email protected] wrote:
Can anybody tell me where the div, that splits submitted from comments,
appears from?
What does the post partial & generated html look like ? Could you have
forgotten to close a tag or something like that ?
Fred
Hope this helps
I’ve attached the generated html.
The partials are defined in this extract from user_controller.rb
def show
@user = User.find(params[:id])
@posts_submitted = @user.posts.find(:all,
:limit => 6, :order => ‘posts.id DESC’)
@posts_commented_on = @user.posts_commented_on.find(:all,
:limit => 2, :order => ‘comments.id DESC’)
end
How can it create a div in the middle of a find operation?
You were right, stupid of me. Thanks
On Mon, May 17, 2010 at 7:47 AM, Neil B. [email protected] wrote:
Hope this helps
How can it create a div in the middle of a find operation?
Attachments:
http://www.ruby-forum.com/attachment/4739/index.html.erb
Let’s look at the first post from that
posts commented on by gleb
Hi, I am a dog. Woof,woof
<em>Please log in to place a comment.</em>
<a href="/session/new">Login</a>
Submitted by: rover
You have one
tag and two
tags, which isn’t balanced.
This appears to be consistent for each post.
I would guess you want that last closing div tag and not the one 4 lines
above.
I suspect that this is in _post.html.erb
HTH
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale