Displaying 9 results from an estimated 9 matches for "post_pages".
Did you mean:
dst_pages
2006 Apr 07
2
Paginate single items
Hi,
In my blog i display a post. I want to display a link tot he previous
post if there is 1 and a link tot he next post if there is one.
So i have in my controller
def post
@post = Post.find(params[:id])
@post_pages, @posts = paginate :posts, :per_page => 1
render(:layout => false)
end
And the following code in post.rhtml
<% if @post_pages.current.next %>
<%= link_to ''nextitem'', :action => "post", :id =>
@post_pages.current.next %>
<% end %>...
2006 Jun 14
4
Using now() to determine what should be displayed
I''m trying to create a paginated list that will take note of the
"end_date" field in my table. This is what I have:
@post_pages, @posts = paginate(:posts, :per_page => 10, :order_by =>
''end_date'')
in the controller. And for the view:
<h1>Posts ending soon</h1>
<ul><% for post in @posts do %>
<strong>Post Title: </strong><%= post.title %> <strong> Da...
2006 Jun 15
1
Multiple :conditions?
How do I add multiple conditions to a paginated list? I have:
@post_pages, @posts = paginate(:posts,
:per_page => 10,
:conditions => [ ''(title) OR (body)
LIKE ?'', ''%'' + params[:query] + ''%''],
:order =>...
2006 Jun 08
3
MVC and Pagination
Just wondering how to best integrate with pagination and still stick to
MVC...
Say I have a Post model that has a published attribute. I want to show
all the recent published posts on a page.
My first instinct is to create a method in the Post model called recent
that does the find with proper conditions and order, but the problem I
have is how do I use that with pagination (which definitely
2006 Jun 15
1
Paginating a .find
how exactly would I apply paginate to a .find I have:
@posts = Post.find(:all,
:conditions => [ ''(title) OR (body) LIKE ?'', ''%''
+ params[:query] + ''%''],
:order => ''end_date'')
How would I go about paginating the uoputed list? Something like 10 on a
page.
--
Posted via
2008 Mar 31
10
Paginate with Rails 2.0.2 question
Hi,
So I''m using @post_pages, @posts = paginate :posts, :per_page => 10
to paginate.
But I have rails 2.0.2 on my VPS. Now this version of paginate throws
an error. What happened to classic pagination and what is done now?
Thanks,
Ron
--~--~---------~--~----~------------~-------~--~----~
You received this message becau...
2006 Jul 14
0
acts_as_nested_set and acts_as_threaded
...ng the following error:
undefined method `display_threads'' for #<PostController:0x3ae9828>
...
#{RAILS_ROOT}/app/controllers/post_controller.rb:18:in `list''
Line 18 in post_controller.rb shows:
[post_controller.rb]
def list
display_threads @posts <= line 18
@post_pages, @posts = paginate :posts, :per_page => 10, :order =>
"root_id desc, lft"
end
The display_threads method is defined in:
[post_helper.rb]
module PostHelper
def display_threads (threads)
(snipped)
end
end
My understanding is that Helper code is merged with Controller...
2006 Jul 22
0
RSS XML Generation Problem
...r)
xml.category(post.influence_level)
xml.description(@influence)
xml.pubDate(post.created_at.rfc2822)
xml.link(post.permalink)
xml.guid(post.permalink)
end
end
}
Here''s the controller.
def rss
@post_pages, @posts = paginate :posts, :per_page => 10, :order => ''id
DESC''
render :layout => false
end
When I display the file at /mycontroller/rss I get what appears to be the
xml
This XML file does not appear to have any style information
associated with it. The...
2006 Jun 20
0
No opening form tag in rendered HTML
...def index
list
render :action => ''list''
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@post_pages, @posts = paginate :posts, :per_page => 10
end
def show
@post = Post.find(params[:id])
end
def new
@post = Post.new
end
def create
@post = Post.new(params[:post])
if @post.save
flash[:notice] = ''Post was successfully created.''
redirect...