search for: person_id

Displaying 20 results from an estimated 104 matches for "person_id".

2009 Feb 27
4
Optimize for loop / find last record for each person
I want to find the last record for each person_id in a data frame (from a SQL database) ordered by date. Is there a better way than this for loop? for (i in 2:length(history[,1])) { if (history[i, "person_id"] == history[i - 1, "person_id"]) history[i, "order"] = history[i - 1, "order"] + 1 # sam...
2006 May 26
3
Breakdowns in has_many abstraction
...ellas => [#<Umbrella:0x38d7218 @attributes={"name"=>"U. Horatio", "id"=>"1", "person_i d"=>"1"}>, #<Umbrella:0x38d5ca0 @attributes={"name"=>"U. Glavellus", "id"=>"2", "person_id"=>"1"}>] > @umbrellas.each{|u| u.name = u.id.to_s} => [#<Umbrella:0x38d7218 @attributes={"name"=>"1", "id"=>"1", "person_id"=>"1"}> , #<Umbrella:0x38d5ca0 @attributes={"name"=>&quo...
2007 May 16
5
drop a letter
hello, how can I do to drop C from this character "C325" ? _____________________________________________________________________________ [[alternative HTML version deleted]]
2005 Mar 04
3
optimization
...5mPerson Load (0.219000) [0;37mSELECT * FROM people WHERE id = ''1'' LIMIT 1 [4;33mPerson Columns (0.203000) [1;37mSHOW FIELDS FROM people Rendering person/show within layouts/xhtml11common [4;35mAccount Load (0.203000) [0;37mSELECT * FROM accounts WHERE service_id = 6 AND person_id = 1 LIMIT 1 [4;33mAccount Columns (0.234000) [1;37mSHOW FIELDS FROM accounts [4;35mAccount Load (0.234000) [0;37mSELECT * FROM accounts WHERE service_id = 6 AND person_id = 1 LIMIT 1 [4;33mAccount Load (0.234000) [1;37mSELECT * FROM accounts WHERE service_id = 6 AND person_id = 1 LIMIT...
2006 Jan 09
3
Design Question
...insight into this. This is more towards the database design for the scenario below: Say for example, I have a person table and this person can have different address types. One could be Home and the other could be say Office. Should be model this Table people id fname lname Table addresses id person_id addr1 addr2 .... or Table people id fname lname Table addresses id addr1 addr2 Table persons_addresses person_id address_id Are there any tutorial that explains these concepts? Any help is highly appreciated. Thanks Silvy Mathews -------------- next part -------------- An HTML...
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to. table people with columns person_id, person_name table clubs with columns club_id, club_name And I have the association table: table clubs_people with columns person_id, club_id Now I know how to do this habtm between the two, in order to associate people with clubs that they belong to. However my application also needs a second...
2010 Nov 02
7
Testing attr_accessible (and/or attr_protected)
...rg/msg01570.html Which seemed like a plausible example, but my attempt (modeled on the example) doesn''t work: describe Article, ''protected attributes'' do it ''should deny mass-assignment to the user_id'' do lambda { article.update_attributes(:person_id => @person.id) }.should raise_error end end The lambda doesn''t raise an error, even though the attr_accessible doesn''t include person_id. Where am I stumbling here? Is it my beginner''s knowledge of rails, or beginner''s knowledge of Ruby? Thanks, Iain
2006 Oct 02
2
when to use find_by_sql
I have a bunch of queries to compute some counters, like find_by_sql(<<-SQL SELECT p.*, c.nfavourites FROM people p, ( SELECT fp.person_id, COUNT(fp.user_id) as nfavourites FROM favourite_people fp, users u WHERE fp.user_id = u.id AND u.cluster = ''#{in_cluster_of_user.cluster}'' GROUP BY fp.person_id ) as c WHERE p.user_id IS NOT NULL AND p.id = c.person_id ORDER BY...
2006 Apr 17
1
database design Q
I am in the middle of setting up mysql database for my RoR application. and here is some questions in my mind hope you can help. 1. this is a photoblog story telling like system, where people can creat their own groups the database tables are: people, groups, articls, pictures People to Groups are many-to-many relationships People to Articles are one-to-many Group to Articles are one-to-many
2006 May 16
1
:conditions on has_one realationship
...r and it should find any records from the table people that have an active membership in table memberships. As far as I can tell this should generate this SQL:- SELECT people.`id` AS t0_r0, people.`firstname` AS t0_r1, people.`surname` AS t0_r2, memberships.`id` AS t1_r0, memberships.`person_id` AS t1_r1, memberships.`startdate` AS t1_r3, memberships.`enddate` AS t1_r4 FROM people LEFT OUTER JOIN memberships ON memberships.person_id = people.id WHERE memberships.id is not null and memberships.enddate > now() ORDER BY enddate DESC However the SQL that is generated does not appear...
2007 Feb 26
4
update_attributes and validations
...t:0x31e2d0c @attributes={"first_name"=>"Julia", ... }> >> me.lab_urls => [#<LabUrl:0x31dfc4c @attributes={"title"=>"My Lab Webpage", "url"=>"http://mylabissuper.edu/labpage/", "id"=>"1", "person_id"=>"1"}>] >> me.lab_urls.find(1).update_attributes({"title"=>"", "url"=>"http://mylabissuper.edu/labpage/", "id"=>"1", "person_id"=>"1"}) => false >> me.valid? => true...
2006 Mar 09
4
sort-weirdness - active record issue?
I''m selecting data into a controller and sorting it. The code (in the controller) looks like this: def index @assignments = [] tasks = Task.find(:all, :conditions => ["person_id = ? and actual_end_date is null", session[:user].id.to_s ]) issues = Issue.find(:all, :conditions => ["person_id = ? and status <> ''closed''" , session[:user].id.to_s] ) @assignments.concat(tasks) @assignments.concat(issues)...
2006 Jul 13
2
having a problem with acts_as_state_machine
Hi all: Below is s a dump from script/console in development env. Am I not supposed to be able to find the record later and use the state machine functionality, or have I missed something? Thanks Forrest ---------------------------- >> ts2 = TalkSession.create( :person_id => 2, :pattern_id => 2) => #<TalkSession:0x35811f0 @attributes={"pattern_id"=>2, "id"=>11, "person_id"=> 2, "state"=>"looking_for_experts"}, @new_record=false, @errors=#<ActiveRecord::Errors:0x34627b0 @base=#<TalkSessio...
2008 May 02
1
names of select elements inside a fields_for block not generated as expected
...m w/code like so: <% form_for(@project) do |f| %> [project stuff here] <% for pp in @project.project_person %> <% fields_for ''project[proj_people_attributes][]'', pp do |pp_form| %> <p> Person: <%= collection_select(:pp, :person_id, Person.get_list, :id, :nom, {:prompt => ''Person?''}) %> Role: <%= select(:pp, :role, Person::ROLE_NAMES, {:prompt => ''Role?''}) %> </p> <% end %> <% end %> <% end %> I get the expected series of...
2006 Jun 06
1
Please Help with single table inheritance relationships
...ave an addresses table, but multiple entities can have Addresses: both Person (which has 2 addresses) and Retailer. I''ve been told that I need to use single-table inheritance, and this was my attempt: # migrate file create_table ''addresses'' do |t| t.column ''person_id'' :integer t.column ''type'' :string .. end # Generated model from rails'' scaffolding class Address < ActiveRecord::Base end # Manually added these 3 classes class ShippingAddress < Address belongs_to :person end class BillingAddress < Address be...
2006 Jul 04
1
select(object, method, choices, options = {}, html_options = {})
Hi, I''m using: select(object, method, choices, options = {}, html_options = {}) I''ve read the API where there''s this example: select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) should give this code: <select name="post[person_id]"> <option></option> <option value="1" selected="selected">David</option> <option va...
2006 Mar 17
4
deleting from hash question
..." => "Do Your Homework", "chores" => "Your Have Chores", "exercise" => "Don''t Forget to Exercise" } and then I had an Assignment model with: def self.find_assignments(person) find(:all, :conditions => ["person_id = ?", person .id]) end Which I called in the controller like so: @current_assignments = Assignment.find_assignments(@person) So, @current_assignments works fine. Now, the problem. I want to display the tasks which have NOT yet been assigned (so that they can be assigned if desired). In th...
2013 Nov 19
1
Does function read.sas7bdat() have some memory limitations?
Dear R-ers, I was trying to read in a large sas7bdat file (size 148094976 bytes) using 'read.sas7bdat()', but it did not read in the data correctly. E.g., the first 5 rows will come out like this (I'm omitting other columns to keep it readable): PERSON_ID age 1 5.399114e-315 5.329436e-315 2 5.399114e-315 5.328302e-315 3 5.399114e-315 5.332026e-315 4 5.399114e-315 5.329112e-315 5 5.399114e-315 5.331055e-315 If I reduced the original sas dataset to the first 5 rows, 'read.sas7bdat' read them in correctly: PERSON_ID age 1...
2006 Jan 24
3
Merging two heavily referenced records into one
Here''s the situation: I have a "people" table whose "id" column serves as a foreign key to several other tables (authorships, editorships, members, users, etc.). Every now and then I will find two distinct records in the "people" table that represent the same human being. They generally differ by small differences in spelling but should really be the
2007 Nov 22
1
has_many :through questions
...cord::Base belongs_to :event belongs_to :person end The database tables are as follows: ActiveRecord::Schema.define(:version => 3) do create_table "attendees", :id => false, :force => true do |t| t.column "event_id", :integer t.column "person_id", :integer t.column "bit_flags", :integer end add_index "attendees", ["event_id"], :name => "index_attendees_on_event_id" add_index "attendees", ["person_id"], :name => "index_attendees_on_person_id" crea...