Displaying 14 results from an estimated 14 matches for "firm_id".
2012 Mar 24
3
How to compute within-group mean and sd?
Hi, I want to run something like
SELECT firm_id, count(*), mean(value), sd(value)
FROM table
GROUP BY firm_id;
But I have to write a for loop like
for ( id in unique(table$firm_id ) {
print(paste( id, mean(table[firm_id == id, "value"]) ))
}
Is there any way to do it easier? Thanks :)
Best,
Reeyarn Lee
[[alternative...
2005 Dec 23
1
pagination problem
...e database i have 32 records
and the sql filtered 4 records
#getting the callerid records depending on the given paramaters and paginate it
@callerid_pages = Paginator.new self, CallerId.count, 10, @params[''page'']
@caller_ids = CallerId.find(:all, :conditions =>["geotags.firm_id = ? ",
@firm_id], :order => " geotags.address1 ASC", :include => [:geotag],
:limit=>@callerid_pages.items_per_page, :offset=>@callerid_pages.current.offset)
How come i get extra next and previous tags, with no records diplays
when i count the next and previous tags, i ge...
2005 Sep 28
0
search engine, select the selected option
...ot;employee_id">Employee</label></td>
<td colspan="3"><%= select "employee", "id", @employees.collect {|e|
[e.last_name + " " + e.first_name,e.id]} %></td>
</tr>
code controller
@employees = Employee.find_all_by_firm_id(firm_id, :order =>"last_name ASC")
@geotags = Geotag.find_all_by_firm_id(firm_id, :order =>"address1 ASC")
@employee_id = params[:employee][:id].blank? ? '''' : params[:employee][:id]
@geotag_id = params[:geotag][:id].blank? ? '''' : params...
2008 May 07
1
Assigning to the foreign key on a belongs_to association
...rb
index b8ec911..c130db2 100644--- a/activerecord/test/cases/
associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/
belongs_to_associations_test.rb
@@ -45,6 +45,13 @@ class BelongsToAssociationsTest <
ActiveRecord::TestCase
assert_equal apple.id, citibank.firm_id
end
+ def test_foreign_key_assignment
+ signals37 = accounts(:signals37)
+ assert_equal companies(:first_firm), signals37.firm
+ signals37.firm_id = companies(:another_firm).id
+ assert_equal companies(:another_firm), signals37.firm
+ end
+
def test_no_unexpected_aliasing...
2005 Dec 14
0
how to get these records in has_and_belongs_to_many relation
hey,
i my database i have users and groups, each user can get in different groups
my db structure:
table groups: id, name, basegroup, firm_id
table users: id, firstname, lastname, email
table groups_users: group_id, users_id
my relation is a many to many:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
i want this http://wiki.script.ac...
2005 Dec 15
3
How to delete a record
hey,
i my database i have users and groups, each user can get in different groups
my db structure:
table groups: id, name, basegroup, firm_id
table users: id, firstname, lastname, email
table groups_users: group_id, user_id
my relation is a many to many:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
i want this http://wiki.script.acu...
2005 Dec 19
6
how to do security??
hey, i have maded some security in my website based on
http://www.chaconforcongress.com/accounts/login
Here they work with users, roles and persmission, and they check it like this,
user.has_permission(permission).
I have extended this to: users and groups with roles and permissions.
With permissions like "view records","edit records","delete records",...
def
2006 Jan 03
0
has_and_belongs_to_many include problem
....id
and groups_users.user_id = users.id and users.last_name like ''%" +
@last_name.to_s + "%'' order by users.last_name ASC, users.first_name ASC")
i get an error on this (can anyone help me???)
@user_pages, @users = paginate :user, :conditions => [''users.firm_id = ? and
users.first_name like ? and users.last_name like ?'', @firm_id,
"%#{@first_name}%", "%#{@last_name}%"] ,:include => [:groups], :order_by =>
"users.last_name ASC, users.first_name ASC", :per_page => 10
private method `scan'' called for...
2005 Dec 22
0
conditions on model
...false
else
text += ", " + client.id.to_s
end
end
if first == false
text += " ) "
end
end
#getting the clients records depending on the given paramaters and paginate it
@client_pages, @clients = paginate :client, :conditions => [''firm_id = ? and
name like ? and '' +
''address1 like ? and zip like ? and city like ? and country like ? and deleted
like ? ''+ text,
@firm_id, "%#{@name}%", "%#{@address1}%", "%#{@zip}%", "%#{@city}%",
"%#{@country}%",0] ,
:order...
2005 Dec 01
0
problem with options_from_collection_for_select() need id not name
...alled by ajax
if @request.xml_http_request? #called by ajax
@geotag_id=params[:geotag_id].nil? ? -2 : params[:geotag_id]
else
@geotag_id=params[:geotag][:id].blank? ? -1:params[:geotag][:id]
end
else
@geotag_id = -1
end
i use this
@geotags = Geotag.find(:all, :conditions =>[''firm_id = ? and client_id = ? '',
firm_id, client_id])
@geotag_options = @geotags.collect {|g| [g.address1 + ", " + g.address2 + ", "
+g.floor + ", " + g.city ,g.id]}
<%= select("geotag", "id", @geotag_options) %><br/>
<select name=...
2004 Dec 07
30
Bind Variables in Active Record
OK, I have some basic functionality to support bind variables, it
appears to work with the ''old'' %s style too.
I''ve altered sanitize_conditions in
activerecord/lib/active_record/base.rb to check whether bind variables
are in the statement (/\?/). If they are, replace all the ?s to
escaped values from the arguments array. else santize and expand.
There are a few
2007 Sep 28
4
undefined method error
Hi,
I''m running the trunk version with drb server. In my ferret_server.log I
get a lot of messages like this:
#method_missing(:add, ["User", {:first_name=>"blah", :comments=>nil,
:company=>"blah", :phone_day=>""}])
Over and over again.
But more importantly, since yesterday doing a search has caused an
exception:
A NoMethodError
2007 Oct 07
0
Rails AR/Oracle Unit Test: [7769] failed (getting worse)
...test_case_adapter.rb:19:in `run''
4) Error:
test_joins_dont_clobber_id(FinderTest):
ActiveRecord::StatementInvalid: OCIError: ORA-00905: missing keyword: select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT companies.* FROM companies INNER JOIN companies AS clients ON clients.firm_id = companies.id WHERE (companies.id = 1) AND ( (companies.type = ''Firm'' ) ) ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0
./test/../lib/active_record/connection_adapters/abstract_adapter.rb:137:in `log''
/usr/pkg/ruby184/lib/ruby/gems/1.8/gems/activerecord...
2006 May 02
4
Bug in rails ?
Hi !
I just have a simple question.
I am writing an app using rails to familiarize myself with the framework (which is pretty cool, by the way).
I just wanted to know why these two work differently (since "find" should be a synonym for "detect" according to the Pick Axe) :
current_item = @invoice.line_items.detect {|i| i.product.id == key}
current_item =