Hi there,
I have Ajax Pagination (sort of) working on my Ruby on Rails Project.
However my problem is, is that it repeats each page x number of times, x
being equal to the amount of records I have on each page.
So lets say for example prior to the Ajax Pagination, I had 12 records
per page, now I have each record on that page replicated 12 times.
I render a partial as follows.
Username |
Date Leaving |
Date Submitted |
Approved |
Date Updated |
<% div_for for holidays in @holidays%>
<%= link_to holiday.user.username, holiday %> |
<%= holiday.dateleaving%> |
<%= time_ago_in_words(holiday.created_at) %> |
<%= holiday.approved%> |
<%= time_ago_in_words(holiday.updated_at) %> |
<% end %>
Any ideas?
On 7 April 2012 20:07, Antony S. [email protected] wrote:
I render a partial as follows.
<% div_for for holidays in @holidays%>
That should be “for holiday in” not “for holidays in”
Have a look at the Rails Guide on Debugging, it will show you how to
debug code so you can work out such problems yourself.
Colin
Any ideas?
–
Posted via http://www.ruby-forum.com/.
–
You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
gplus.to/clanlaw
On 7 April 2012 20:47, Colin L. [email protected] wrote:
<% div_for for holidays in @holidays%>
That should be “for holiday in” not “for holidays in”
Have a look at the Rails Guide on Debugging, it will show you how to
debug code so you can work out such problems yourself.
But even then I am not convinced it will work. What is the div_for
doing there? Since you have not got “<%= div_for” the div_for will
not actually produce any code. I think more likely you want something
like
<% @holidays.each do |holiday| %>
<%= div_for holiday do %>
Colin
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
gplus.to/clanlaw
–
gplus.to/clanlaw
Changed that, still doesn’t work.
Will have a look at the debugger.
Thank you
Colin L. wrote in post #1055435:
On 7 April 2012 20:07, Antony S. [email protected] wrote:
I render a partial as follows.
<% div_for for holidays in @holidays%>
That should be “for holiday in” not “for holidays in”
Have a look at the Rails Guide on Debugging, it will show you how to
debug code so you can work out such problems yourself.
Colin
Any ideas?
–
Posted via http://www.ruby-forum.com/.
–
You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
gplus.to/clanlaw
Right that’s worked, however it now puts the column headings above each
record?
Apologies.
Your code has worked. 12 Records now show up. However the column
headings appear above each record, instead of just at the top.
Username |
Date Leaving |
Date Submitted |
Approved |
Date Updated |
<% div_for holiday do %>
<%= link_to holiday.user.username, holiday %> |
<%= holiday.dateleaving%> |
<%= time_ago_in_words(holiday.created_at) %> |
<%= holiday.approved%> |
<%= time_ago_in_words(holiday.updated_at) %> |
<% end %>
On 7 April 2012 21:25, sherpa derpa [email protected] wrote:
Right that’s worked, however it now puts the column headings above each
record?
What has worked? Since you have not quoted any previous reply no-one
knows what you are referring to. First work out what html you want
then write to code to generate that html. If you don’t know what html
you want this is not really the right place to ask as that is nothing
to do with Rails. If you know the html you want but the code is not
generating the html you want then you can ask here.
Colin
On 7 April 2012 21:38, sherpa derpa [email protected] wrote:
Apologies.
You’re code has worked. 12 Records now show up. However the column
headings appear above each record, instead of just at the top.
Once again you have not quoted the previous reply so we don’t know
which message you are referring to.
<% div_for holiday do %>
<%= link_to holiday.user.username, holiday %>
<%= holiday.dateleaving%>
<%= time_ago_in_words(holiday.created_at) %>
<%= holiday.approved%>
<%= time_ago_in_words(holiday.updated_at) %>
<% end %>
That code only seems to show one record. I don’t see any loop in it.
Colin
On 7 April 2012 21:49, sherpa derpa [email protected] wrote:
The code
<%= div_for holiday do %>
Apart from the fact that there is no loop in the code, is it legal
html to have td tags inside a div? Even if it is I can’t think of any
good reason for it.
Colin
The code
<%= div_for holiday do %>
What i have is each individual record now having the column headings
above the record, when it should be on top of every page just once?
Colin L. wrote in post #1055437:
On 7 April 2012 20:47, Colin L. [email protected] wrote:
<% div_for for holidays in @holidays%>
That should be “for holiday in” not “for holidays in”
Have a look at the Rails Guide on Debugging, it will show you how to
debug code so you can work out such problems yourself.
But even then I am not convinced it will work. What is the div_for
doing there? Since you have not got “<%= div_for” the div_for will
not actually produce any code. I think more likely you want something
like
<% @holidays.each do |holiday| %>
<%= div_for holiday do %>
Colin
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
gplus.to/clanlaw
–
gplus.to/clanlaw
Thank you for your help Colin.
I think I know what I need to do.
Colin L. wrote in post #1055448:
On 7 April 2012 21:49, sherpa derpa [email protected] wrote:
The code
<%= div_for holiday do %>
Apart from the fact that there is no loop in the code, is it legal
html to have td tags inside a div? Even if it is I can’t think of any
good reason for it.
Colin