Displaying 20 results from an estimated 20000 matches similar to: "Can''t connect to MySQL"
2011 Apr 07
0
Refactor sorting of images
Hi guys,
I am a bit stuck here, I know the following is damn wrong, but I
couldn''t figure out
a cleaner solution yet.
I have a bunch of images, each one has a published date and a ''liked''
number.
A user can click like from an image once.
The index of the images can be sorted after ''liked'', and ''published''.
The show from an image has
2007 Jun 14
1
rspec will_paginate
Hi Rspec-Users,
I''m not sure if I am correctly specing my index since I''m using
will_paginate.
params[:filter_by] will filter the paginate list accordingly.
Tickets Controller:
def index
@tickets = Ticket.filter_status_by(params[:filter_by],params[:page])
end
Ticket Model:
def self.filter_status_by(status, page, per_page = 10)
conditions = {:status => false} if
2006 Jun 11
0
mySQL paginate syntax question for complex SQL. (over 117 views in rubyonrailsforum and no answer, others confused..)
I have this code in my controller and i cannot seem to figure out how to get
it to paginate correctly.. Is there a trick to do something like this?
There are a few others at www.rubyonrailsforum.com that are having the same
issue. Any incite would be great, thanks in advance!
(over 117 views and no answer in rubyonrailsforum???)
def display_location
if params[:search] &&
2007 Jan 15
2
Help with with displaying a selected list.
Hello. I call a find_all_by_subject("action") which returns 2 videos
and displays them properly. But when I add @video_pages, @videos =
paginate :videos, :per_page => 10 so I can paginate the videos, it
displays ALL the videos as if I selected list videos. Can someone
please tell me what I am doing wrong? Thank you.
selectaction.rhtml
<table>
<tr>
<% x = 0 %>
2006 May 23
1
Re: Wierd pagination problem - Unknown options:
> Unfortunately I still get the same error. Here is my code now (the
> commented line works):
>
> def list
> @upload_pages, @uploads = paginate(:uploads, :per_page =>
> 20, :order
> => ''id'')
> # @upload_pages, @uploads = paginate(:uploads, :per_page => 20)
> end
You may have an older version, try using the order_by clause
2006 Apr 12
1
how do i paginate the results of a query?
I have a controller and list page for region object. My list page has a
''name'' text input that can be used to limit the list.
It works except that the paginate gets the full set of regions unqualified
by my search term. I believe this full list is contained in :regions symbol
which I dont seem to be allowed to modify or replace (yes I am a ruby and
rails newb). How can I
2006 Feb 13
1
another simple question: per_page in pagination
Hi,
Why can''t I use a variable to specify the :per_page attribute when using
the most basic form of pagination? (if I use a hardcode number, it
runs) What did I do? Thx.
My code:
def list_orders
page_size = 20
...
order_pages, @orders = paginate(:orders, :per_page => page_size)
end
My Errors:
undefined method `>'' for false:FalseClass
RAILS_ROOT:
2006 Mar 18
2
Need help with my view populating rows
Hello, I was talking with someone in IRC, trying to get one form with
however many fields to make new rows. He worked with me on the controller,
but then I didn''t get the help with the view I needed, and I''ve been trying
to do it on my own.
I''m uploading pictures to my Pictures table. As you know, I need a few
fields for each picture. I''ll need the filename,
2006 Jun 07
1
has_many, through, want to store email in mysql
Hi,
I''m still a new with ROR, but it''s really cool :) I just have this
problem with a project of mine.
I want to store email in a database. I already wrote a simple import
script, that works, so that''s not a problem. Showing the email
(efficiently) in a ROR site is.
These tables are in the database:
emails
id
email_id (foreign key -> emails.id)
seq
2008 Nov 27
7
will_paginate issue
Hi,
I am trying paginate (will_paginate) users posts. It is counting and
showing the page links correctly, but still showing all the posts on one
page.
@entries = @user.entries.paginate :per_page => 5, :page =>
params[:page], :order => ''created_at DESC''
If I change it to @entries = Entry.paginate :per_page => 5 ........
It is fine, but I would like to show only
2006 Feb 01
1
Rails pagination problem
I am having this problem with pagination query in my controller class.
I am using SQL server and following code to create pagination fails,
complains about column name ''program_name'' (which is valid
column/attribute of program)
The error message is:
DBI::DatabaseError: S0022 (207) [Microsoft][ODBC SQL Server
Driver][SQL Server]Invalid column name
2006 Jan 09
3
Pagination :conditions not working - MySQL v. PostgreSQL, Rails abstraction v. embedded SQL
Hi everyone,
I have this code:
@person_pages, @people = paginate :person, :per_page => 20,
:conditions => [ "username LIKE ? OR first_name LIKE ? OR
last_name LIKE ? OR preferred_name LIKE ?",
"%" + params[:q].downcase + "%",
"%" + params[:q].downcase + "%",
2006 Feb 13
1
Paginate @member.items?
Is there a quick and easy way to paginate something
like @member.items (Member with has_many :items)?
Right now I do in the controller:
@item_pages, @member_items = paginate :item,
:conditions=>["member_id=?", @member.id],
:per_page=>25,
:order=>''datetime desc''
It''d be more DRY if this was possible:
@item_pages, @member_items = paginate
2006 Aug 07
4
Problem with Pagination
Hi Guys,
I am trying to paginate the results from a search. When I use actual
constants in the search conditions, it works fine:
def query
@k2_result_pages, @k2_results = paginate (:k2_results,
:conditions => [''e_date >= ? AND
e_date <= ?'', ''2006-07-12'', ''2006-08-12''],
2006 Mar 13
6
lame newbie question: how to pass instance variables
This should be obvious - but I''m a long-time non-web app programmer and
new to rails.
I simply want to put something in a variable in one action and access it
in another.
It''s like this, I''m doing a simple photo gallery/managment app, and I
have two actions in my picture_controller:
The first one scans the picture directory and creates a new object in
the pictures
2006 Jun 10
1
paginate session problem.. (syntax question)
I have this code in my controller and i cannot seem to figure out how to get
it to paginate correctly.. Is there a trick to do something like this?
There are a few others at www.rubyonrailsforum.com that are having the same
issue. Any insite would be great, thanks in advance!
def display_location
if params[:search] && params[:search].size > 0
@listing_pages, @listings =
2006 Nov 08
0
Paginating a fetched resultset problems with next/previous
Im using this paginate function to paginate complex sql queries
http://www.bigbold.com/snippets/posts/show/389, all seems to work fine
but theres one thing, when i hit the next link it show nothing, i mean
it only shows the first page, here is the code im using:
#application.rb-----------------
def paginate_collection(collection, options = {})
default_options = {:per_page => 10, :page
2006 May 22
4
use join table in paginate
How come I allways immediately run into difficult stuff when I''m trying
some new programming language? Am I blind for the simplicity of
Ruby/Rail, which a see must be there? Anyway, don''t try and answer this
rhetoric question. I have got another one for you, seemingly difficult.
I''m struggling with a n:m relationship (in a database, that is) and its
join table.
2009 Oct 28
2
mislav-will_paginate(will_paginate)
mislav-will_paginate(will_paginate) doesn''t work after search.
servers_controller.rb
def index
@servers = Server.paginate(:page => params[:page], :per_page => 20,
:order => ''device_id ASC'')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @servers }
end
end
def search
@servers =
2009 Aug 13
2
ajax with will_paginate problem
i can use <%= link_to_remote("MEMBER LIST",:update => "mcont", :url =>
{:controller => :users, :action => :list }) %> this for user listing and
then it display record i want to do paging on this list file but it is
display one page when i click on second page this will no go to second
my controller
def list
#@images = Image.paginate :page =>