search for: stock_group

Displaying 2 results from an estimated 2 matches for "stock_group".

2005 Jan 24
1
lookups and joins
...he following: # This gives me two columns, one the lookup value and the second one # the result column, ie my lookup table. stcl = read.csv("stockclass.csv") stockclass = as.vector(stcl$stock_class) # This gives me what appears to be a dictionary or map names(stockclass) = as.vector(stcl$stock_group) getstockclass = function(stock_group) { try(stockclass[[stock_group]], TRUE) } csg$stk_class=factor(sapply(csg$stock_group, getstockclass)) I need the try since if there is a missing value I get an exception. I also tried something along the lines of (from memory): getstockclass = function(sto...
2006 Apr 04
1
has_many fails where find_by_sql succeeds
Can anyone explain why the method form of the following works, but the (apparently identical) has_many fails? I have 3 sites in my fixtures. Initially, for a new StockGroup, sites_not_using_this_stock_group should return all 3 sites (which it does). When you add a site to the StockGroup, it should disappear from the output of sites_not_using_this_stock_group. But the has_many form returns all 3 sites. I can''t see any difference myself? Thanks Ashley class StockGroup < ActiveR...