similar to: [PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.

Displaying 20 results from an estimated 1000 matches similar to: "[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries."

2007 Apr 04
1
[PLUGIN] count_from_query - easily convert finder queries into count queries
count_from_query gives you the ability to generate a COUNT query from a standard Rails find. For example, if you have the query User.find :all it would be trivial to get a count: User.count however, if you have a more specific finder method, such as class Company < ActiveRecord::Base def complete_videos Video.find :all, :conditions => "company_id=#{id} AND
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 %>
2005 Mar 15
2
Asterisk Queue strange behaviour
Hi. I have a problem which I assume would be easy to fix, but I can't find anything about it... I wish to have people dialing my phone, and if it is busy, they are put into a queue. And then I am dialed back when the previous call is finished, and connected to the waiting caller. Easy enough? ----------exten exten => 6,1,Background(salesq-intro); exten => 6,2,Queue(salesq|tT|||300);
2007 Sep 03
6
blog post on story runner
Here''s an excellent blog post on Story Runner, which will be part of the next release and is undergoing active development in trunk: http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner
2007 Jan 19
3
Something cool I learned about rspec today
I found an awesome feature today. When you''re setting expectations, you can actually pattern match the parameters to methods. Here''s my discussion and example: http://evang.eli.st/blog/2007/1/19/parameter-matching-in-rspec Pat
2007 Sep 20
10
Getting Started with Story Runner
I haven''t found any How To''s to use story runner and I''m not sure how to get started. Should I be looking for resources on how to use rbehave? How do I generate my first Story? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070920/07a80bc7/attachment.html
2008 Mar 03
2
Testing Plugins + Lib Code
Hi, I''m quite new to Rspec and I''m embarking on a new project. One thing I''m really not sure about is how to test plugins and code in your ''lib/'' folder. Where would these specs actually live in the dir structure? Should you test plugins by creating specs within the plugin''s dir? Or by adding a spec to the main ''/specs''
2006 Jul 23
2
how to paginate child records
hi i know i can do: @customer_pages, @customers = paginate :customers, :per_page => 8 but these customers have helpdesk calls which are child records. I hoped i could do something like paginate customers.calls, but dat doesn''t work what is the best way to get a paginated list of child records? remco -- Posted via http://www.ruby-forum.com/.
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.
2007 Mar 13
1
Opening the singleton class of mocked objects
I wrote a plugin [1] a while ago that lets me do validations on a single AR instance. Instead of defining validations in an AR class, I can define them on a AR instance''s singleton class: class << @video validates_presence_of :title end One of my specs mocks Video.find, and the above code is run on the mock object. When I run the spec, I get the expected undefined method
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 =
2008 Jan 21
3
Story runner "macros"
I''ve gotten quite a bit out of Pat Maddox''s screencast http://evang.eli.st/blog/2007/10/8/story-runner-top-to-bottom-screencast One thing I''m not sure of is the feature where he writes things like: When "I POST to", "/articles", :post => {:title => "Title", :body => "Body") do | path, params| post_via_redirect
2007 Sep 15
3
How to write a plugin that uses rspec internally?
My team is working on a plugin and we want to use RSpec internally for the plugin''s tests. (a) What are some different ways to go about this? Should we rely on the RSpec gem? Should we expect that the "host" Rails application has installed the RSpec plugins? Are there other options? (b) Which approach from (a) would you recommend? (c) Would you recommend any particular
2008 Jun 10
1
Refactoring''s code needs refactoring''s specs?
Hi guys, I have one question: When refactoring the working code I need or should refactoring the specs too? My old code is: http://pastie.org/private/gpskgtavm4yzutanq1ro3w My new refactored code: http://pastie.org/private/2emgi1hr5iga3m9jib4q and the specs that are still passing without refactoring: http://pastie.org/private/qn3uaoin0k2n8vjsusssg Regards. -- "Most of you are
2007 Feb 21
1
Rendering all the elements when calling Array#to_xml
When I call to_xml on an array, I want it to get the XML for all the elements in it. I''ve defined to_xml in my class. >> r.to_xml => "<video><id>1</id><views>2</views></video>" >> a = [r] => [#<StatisticsReport:0x3259f38 @video_id=1, @views=2>] >> a.to_xml => "<?xml version=\"1.0\"
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 May 07
4
Paginate() from multiple tables
Hi I''m wondering if there''s a way I can gather data from multiple tables from the child table by using the paginate method? I would have done it using select_by_sql but I need it to paginate. My table structure is: Records is a child of Date and Account Date Account | | ^ ^ Records I want to be able to print a table using the Records controller that will
2006 Jan 06
4
"Selecting" a calculated row / Using :select in the paginate method
Hi, I was trying to use the :select parameter to select a calculated row, but it appears that the parameter is not picked up by the paginate method. I want to add the following to the select statement: timediff(now(), created_on) as age So I tried: @story_pages, @stories = paginate :stories, {:per_page => 10, :include => ''user'', :select =>
2006 Apr 27
5
def list - paginate question
How do I adapt this code to only list articles made by the user logged into the session? def list @article_pages, @article = paginate :articles, :per_page => 10 end -- Posted via http://www.ruby-forum.com/.
2006 Mar 01
2
Problem with paginate search
Hi, Firts all sorry for my poor english I am doing a simple search with paginate, the problem is the search dont find the words within acutes (example "dont find sal?n if i search salon"). Its the code for the seach: def search words = @params[''search''].to_s.split('' '') array_conditions = [] for w in words array_conditions =