similar to: Are the find_ methods strictly a SQL thing?

Displaying 20 results from an estimated 10000 matches similar to: "Are the find_ methods strictly a SQL thing?"

2006 Jun 08
1
question about finding with :include versus nested dynamic finder (bad form? efficiency?)
I have a User model and a Status model. Each user is given a certain status, either "Accepted", "Rejected", "OnHold", "Declined", etc. I need to find all users with a status of "Accepted", so I''m doing the following: in User.rb: belongs_to :status def accepted_users status_id =
2007 May 05
4
Stop words, fields, StandardAnalyzer quagmire
Hello, I''m using: Ruby 1.8.6, Rails 1.2.3, ferret 0.11.4, acts_as_ferret from svn stable. I''ve had quite a day wrestling with trying to remove the use of stopwords. The problem was that when searching for words like "no" or "the", no results were found. I found a confusing thing behavior that has taken me some time to figure out, and I hope sharing it
2008 Nov 26
3
New status_id in Facebook API - FIX
Hi, I''ve had one of my application broken this morning (French time) with this error : NoMethodError (undefined method `status_id='' for #<Facebooker::User::Status:0x2ad52d1c8478 @message={}, @time="0">): It appear that Facebook API had change in the status : a status_id node is new : <user> <uid>785637999</uid>
2006 Jul 03
1
how to get value from the post on the List page
Hi, I''m new to Rails. I''m building a candidates tracking system for recruiting. I have a List page, but instead of listing every candidate, I only wanted to list the candidates in certain statuses. The first time List page is hit, by default, it lists candidates in status < 9. But on the List page, there is a dropdown where all the statuses are listed, so that when user
2006 Jan 27
1
Basic Many-to-One association
Sari, I got the list display working without doing an explicit find. It took a bit of a conceptual convulution to get it to work. I was thinking of it has Many Cases have One status. There is no support for Many-to-One so I was a bit stumped. Then I realized you just have to turn around your thinking to say One Status has Many Cases. Thus it is a One-to-Many relationship. That is descriped
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?
2006 Aug 09
1
question about enforcing constraints in the model
I have a user model and a status model. Each user has a specific status (accepted, rejected, declined, etc). I have a form that allows the adminstrator to change certain options for a user, including their status. I''m using a drop down menu populated with the different status values, and a default option that says "Choose a new status" with a value of "". I want to
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"
2007 Jul 02
8
Strange intermittent no search results problem
Hello, First the specs: ruby 1.8.6, rails 1.2.3, ferret 0.11.4, mongrel 1.0.1, mongrel_cluster 0.2.1 And the model''s aaf config: # Ferret search engine acts_as_ferret({:fields => {:name => {:boost => 10}, :summary => {:boost => 2}, :body => {:boost => 1, :store => :no},
2006 Apr 25
6
Searching over multiple MySQL tables
I am racking my brain over this, probably because I only know very simple mysql functions. Basically I''ve got a few tables, ex: Albums (id,name,band_id); Bands (id,name,label_id), and Label (id,name) I want to search through both album.name, band.name, and label.name throwing all results into a variable, with no redundant info. I think what I need to be doing is setting up some
2006 Apr 24
8
Application Design
I have a question about how to implement a design in Rails. I will try to make this as easy to follow as possible. First, let''s say that I have an ''Orders'' table that has different statuses. The 3 statuses that I want to track are ''Submitted'', ''Approved'', and ''Purchased''. I also have 3 users of this application.
2006 Mar 23
8
DRY principle - how to implement?
Hi all! I have ''send_status'' table which looks something like these: id code title 1 sent Sent 2 error Sending error 3 success Success Next I would like to associate some processed records with their ''send_status''. Is it better to use: 1) record.status_id = SendStatus.find(:one, :condition => "code=''sent''").id to
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m hoping somebody can set me straight. I have an object AlertTemplate which will contain a fill in the blank style hunk of web content. I then have an object, Alert, which will have a relationship to one of those AlertTemplate objects, plus some data. So, in human speak, I''d think that an Alert
2006 Aug 02
2
Weird relationship thing
Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060802/f8cc6d95/PGP.bin
2006 Jan 31
2
find_by_sql question
I''m no good at SQL and I have a question that will hopefully be fairly easy to answer. I''m using acts_as_paranoid which instead of deleting a record adds a deleted_at column with the datetime the row was deleted. I want to have a find_by_sql filter out any row where deleted_at is not null. I have (at least the relevant parts): #a couple working filters here. filters <<
2006 May 29
9
design recommendations for authenticating users with lots of different attributes..?
I''ve been struggling a bit trying to figure out the best way to design/implement a system with authentication/authorization, and was hoping some of you may be able to offer some advice.. At the moment, I have a system with 4 different types of users - clients, administrators, sales_reps, and public_users. I''m using "Authorizing Users with Roles" from the Rails Recipes
2007 Aug 08
25
Problems with RESTfully generated helpers
I am using helper the RESTfully generated helper methods in my views. My routes are nested so the helpers appear to need arguments passed to them, but it works without arguments. Say for example I have pages and comments. If I do page_comments_path without parameters, it works. However, when I run the rspec test, it fails and tells me i''m missing parameters. I tried to pass
2006 Mar 23
4
belongs_to more than one model
Suppose I have one table: states id statename And I have two other tables that contains states: houses id color state_id places id place_name state_id How would my model relationships look like? class State < ActiveRecord::Base belongs_to house belongs_to place end class House < ActiveRecord::Base has_one state end class Place <
2006 Apr 20
4
Question about Associations
Hi all. Got a stupid-simple question about associations. I have two models - school and course. There are a fixed number of schools (set up in the migration). Each course is assigned a school and a school will be associated with multiple courses... How do I set up the associations? Do (can) I have School :has_one :course and Course :has_many :schools? Does the schools table then get a course_id
2006 Apr 02
7
RANT: belongs_to -> refers_to
Every once in a while, I pipe up and whine that "belongs_to" should really be ''refers_to" [http://dev.rubyonrails.org/ticket/2130]. It''s time again. I''ve got a bunch of stuff going onto eBay, so, like any good engineer, I don''t just post it manually: I design a Rails-based inventory database that creates a semantically-correct XHTML/CSS auction