similar to: Best way to prune my list of returned rows?

Displaying 20 results from an estimated 7000 matches similar to: "Best way to prune my list of returned rows?"

2006 Mar 17
1
Design / Pattern / Scaffold for has-and-belongs-to-many ?
Is there a standard practice for providing a UI into HBTM relationships? I have a model User, and a model Training, and I need to manage both relationships -- show me all the people that have training X, but also show me all trainings user U has. And, of course, "Lookup this user and then add/remove trainings for this person" or "Lookup this training and add/remove
2005 Nov 22
3
Idiom for submit button?
What is the rails idiom for submit buttons on forms? All other field types have helpers, but button_to creates its own form, so should not be used. I''ve looked in "Agile Web Dev. with Rails" but can''t see what I should do instead. Is this "difficult" because it runs counter to AJAX type forms? And, related, is there a way to ensure that hitting return in
2006 Jun 07
2
Making an HTTP request to an external machine
During one of my controller actions I want to call an external machine before I do anything. It''s not a real web service, more like a REST-style thing where I''ll just be tweaking a servlet running on another machine and sending it some data. Does Rails give me anything to work with for doing that? I read the web service stuff but it''s overkill for what I need. I
2006 Jun 09
4
View into a String?
I''ve got a nice XML view of my data that works just fine when I call it from the browser. Now I''d like a different controller method to take that XML and write it to the file system. Since the XML view lives in an RXML file, is there a trick to telling the controller "Get your output into a string" instead of writing it back to the browser? After writing it out
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:
2004 Apr 26
1
troubles working with Voicetronix Openswitch12
dear Hackers, i have a voicetronix Openswitch card, and i have been finding it very dificult to get it to work with asterisk. i intend to connect 8 ports to the PSTN and 4 as station ports. problem 1: On running asterisk all i get at first i get : event[9=>[11] station OFF hook] on vpb/1-12 even [12=>[11] loop drop on vpb/1-12 event [12=>[11] Tone detect:GRUNT event [2=>[11] Dial
2006 Jun 15
1
Ok, I''m stumped on arrays of form fields
My Alert object has_many Links. I''ve got the whole system setup where, once I have the Alert object created, I can use a nice form_remote to show the user all the Links currently attached, and add more. But the form itself starts out with 0 links. What I''d like to do now is construct the form with a couple of default "Place link here" objects in the array, and
2006 Nov 25
2
Comparison between RSpec and test/unit
I''m curious, Christian Neukirchen has released test/unit[1] that seems to mirror much of RSpec, but built on Test::Unit, so in some ways less brittle from a Rails-integration perspective, and also allowing you to mix the two together as appropriate. So, has anyone made an informed comparison? I''m new enough that I don''t really know the finer points yet. The syntax is
2012 Feb 01
6
Does Devise make use of a "status" method? Weird bug.
So I''ve inherited a legacy application and I''m trying to work around the edges as I put an admin tool interface on top of the existing code base. I install Devise for user authentication, since I''ve used it in the past. I change none of the default code. And yet, on successful sign in, I get an error: Render and/or redirect were called multiple times in this action.
2006 Jan 03
4
Set the foreign key constraint column name?
I am applying Rails to an existing schema and not sure how much the existing developers will let me go in and rename things. So I need to discover the limits of what I can change with Rails. I''ve found set_table_name and set_primary_key, which have been very useful. If I have a "foo has_one :bar" relationship, but then in the bar table my column is named "fooid"
2006 Nov 04
0
How to paginate a find_by_sql query?
Does anybody know how to paginate a find_by_sql query? Unfortunately I need to paginate a query which is next to impossible for ActiveRecord or just too much of a pain to implement. So I''m using find_by_sql. However, I anticipate a large number of rows returned eventually. So I may need paginate. Does anyone know how? Thanks Phillip Novess http://primalart.net
2006 Jun 02
3
Where are the best AJAX examples?
Googling for this has not solved my problems. Is there a particular site that is recommened for its examples and tutorials on Rails'' AJAX capabilities? I know exactly what I want to do, just not how to do it, and am looking for some code to pore over. 1) I have a dropdown that represents the name of an image in a library. When the dropdown value is changed, I would like to refresh
2006 May 01
2
Getting my schema straightened out
I''m trying to map Rails to an existing schema, and having a bit of a time of it. I''ve got a table Content, and I''ve got a table Review, which is a type of content. So content has an ''id'' field, and Review has a ''contentid'' field. Not all Content has a Review, but all Reviews have exactly one Content. How do I represent this?
2009 Jul 23
1
How can I paginate records find by using find_by_sql
Hello everyone, I forced to use @user = User.find_by_sql sql_query in a particular situation in my project. Now I want to paginate the records. How can I paginate the records? Please help me. Thanks in advance -- Posted via http://www.ruby-forum.com/.
2006 Jan 23
6
Ruby at O''Reilly Rough Cuts
Not sure if this is old news or not, but it would appear that both the Ruby Cookbook and a Rails book are now available for purchase at O''Reilly Rough Cuts (something akin to PragProg''s beta book program): http://rubyurl.com/nHz http://my.safaribooksonline.com/?mode=roughcuts&srchtext=ROUGHCUTS I haven''t tried them yet, but it definitely seems worth checking out.
2006 Jan 06
2
Paginate from a difficult sql query
Hello, I have 2 tables table colors : +----------------------+ | id | user_id | name | +----------------------+ | 1 | 1 | test1 | | 2 | 2 | test2 | | 3 | 3 | test3 | +----------------------+ table users : +----------------------+ | id | enabled | name | +----------------------+ | 1 | 1 | bob | | 2 | 1
2006 Jun 07
2
Are the find_ methods strictly a SQL thing?
I''ve had a number of occasions now where I want to find something in my model that is not on the primary object. For instance I''ve got a class Alert that has_one Status. Status has a "label". I want to find all of my Alert objects and order the results alphabetically by status label. Can I do that without going into SQL? Right now I find myself doing an
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id, rating, etc. What I have now is something like: if(@params[''category_id'']) @items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id'']) elsif(@params[''category_id''] and @params[''member_id''])
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi, Is there an easy way of querying an active record for a maximum column value? I need to do queries like: SELECT MAX(salary) FROM employees TIA, Jeroen
2007 Jan 24
1
iax2 prun realtime peer only can't prune user
Hi All, I'm running 1.2.9.1. I can prune sip realtime peers and users and iax realtime peers but no command to prune iax realtime users. Was this implemented in a later version? Thanks. JR -- JR Richardson Engineering for the Masses