Displaying 20 results from an estimated 7000 matches similar to: "Objects in Arrays? Allowed, right?"
2006 Jan 18
6
Using conditions in ActiveRecord
This bit of code finds several groups; all those which have
entity_id''s of ''1'' OR ''2'' OR ''3'', as you would expect:
ee = [ 1, 2, 3 ]
groups = Group.find(:all, :conditions => "entity_id in (" + ee.join
(",") + ")")
But this bit of code only finds groups which have entity_id''s of
2008 Sep 29
3
[ActiveRecord] wrong number of arguments (0 for 2) ?!
Hi all,
I have a basic model as follow, but when I try to query the database, I
get the following error:
''wrong number of arguments (0 for 2)''
I don''t see any problem, I am becoming crazy o_O''
Migration
---------
class CreateSubtasks < ActiveRecord::Migration
def self.up
create_table :subtasks do |t|
t.string :hostname, :type
t.integer
2006 Jan 31
4
has_one without inverse belongs_to
I have two models called entity and user.
The entities table has a column called users_id that contains the user
id of the user that created the entity.
In entity I have...
has_one :user
... as I want to be able to show the user who created the entity from
the entity object.
But this produces the following error...
Mysql::Error: #42S22Unknown column ''users.entity_id'' in
2012 Mar 21
1
Using extract function for dates in sqldf
I'm trying to use sqldf to query for the earliest date of a blood test when
patients have had multiple tests in a given year. My query looks like this:
test11 <- sqldf("select CHILD_ID, min(SAMP_DATE)
from lab
group by CHILD_ID
having extract (year from SAMP_DATE) = 2011")
SAMP_DATE has class "date." I get the error
2008 May 27
2
HABTM using two columns
Hi all,
I was wondering whether anyone could guide me to docu and code
examples how to create and use a has_and_belongs_to_many relationship
with a joining table where TWO columns are used to identify the
relation to TWO alternative tables.
Example:
table 1: mothers [mother_id, name]
table 2: fathers [father_id, name]
table 3: children [child_id, name]
joining table 4: children_parent
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200
2009 Feb 15
3
conditions on association include, hacky but more or less solved
Hi all,
I just finally figured out how to get 2.2.2 to do this, and thought
I''d share in case others run into the same thing.
The situation is a find with associations, but the tricky part is that
the association shouldn''t always be loaded. This is similar to putting
a condition on a has_many association in a model, but the condition is
dynamic rather than predefined.
The
2005 Jul 21
1
Self-Referencing Tables and Other DB Complexities
How well does Rails deal with ActiveRecord classes mapping to
self-referencing tables and other more interesting database
complexities?
i.e. Employees table with supervisor_id and mentor_id both
self-referencing Employees on the primary key "id"
or Categories table with relation table (Parent_Child_Categories) with
foreign keys parent_id and child_id both referencing Categories.id
2010 Oct 15
2
XCP xapi debugging
Good day.
Suddenly on pretty high loaded pool with about 50 VM per 5 hosts I got
following problem vm does not start and start command silently waiting.
xe task-list displays pack of tasks with same status and resident-on:
uuid ( RO) : b607ef7b-e185-72d9-4d3a-5795557922fc
name-label ( RO): VM.start
name-description ( RO):
subtask_of ( RO): <not
2006 Apr 20
4
Many to Many Category structure with itself
Basically, I''m trying to have a table called "categories" have a many to
many relationship with itself. But I also want each catagory to be able
to be "copied" into another category so it is essentially a child
category to more than one parent. To me the obvious way of doing this is
by creating another table called category_maps (and a model called
CategoryMap).
2006 May 07
1
Anyone care for a braindump?
I have this problem with records that have to be alligned on end- and
startdate. I came up with the following. but am not convinced that this
is the best way to tackle this problem. Anyone care for a braindump?
def head_to_tail
# Remove days that have startdate >= self.startdate AND enddate <=
self.enddate
#
# before after
#
# |=====| |=====|
2007 Feb 03
7
Interesting radio button behavior with "onclick"
Hello:
I have radio buttons like this:
<% fields_for :goalhist do |g| %>
<table>
<tr>
<td align=left><%= radio_button_tag (''duedate'', 0, checked = false,
options = {:onclick => ""}) %>
Start now
</td>
</tr>
<tr id="detailed" style="display: none"><td colspan=2>
2015 Jan 12
3
[LLVMdev] NP-hard problems in the LLVM optimizer?
Hi all.
I’ve heard a couple of times that some of the problems solved by various
passes in the optimizer are indeed NP-hard, even though the instances
are small enough to be tractable (and very quickly).
Is this true? If so, which are these problems?
Register allocation? Instruction scheduling?
Are they solved exactly or by approximations?
Or not solved at all (the need of solving them is
2007 Oct 22
1
self-referential habtm: why are my keys null?
I''m trying to set up a directional self-referential HABTM to represent
an arbitrary semi-hierarchical structure; it works for any data
prepopulated into the db, but when I try to create a new relationship,
I just get NULLs in both key columns (or 0''s if I turn on the no-null
constraint).
Here are the migrations:
class CreateNodes < ActiveRecord::Migration
def self.up
2006 Jan 06
3
Flashing Window in Quicken
Wine version: all
Linux version: Fedora 3 and Gentoo 2.6.14
Symptom: When running quicken, opening the "Split costs"
dialog causes the program to go into an infinite loop,
flashingthe window to proper size then minimized and back
again, as fast as the display will allow.
It appears that the window is opened and the program
attempts to flash the caret but access is denied to
2008 Mar 28
0
Problems with URL encoding
Hi
I have a problem when sending parameters from link_to_remote. My link
code:
<%= link_to_remote "Remove",
:url => object_relation_path(
:id => 0,
:object_relation => {
:parent_id => @product.id,
:parent_type => "Product",
:child_id => content_object.id,
:child_type => "ContentObject",
2007 May 22
6
Ferret file not found error on item delete
Hi ferreters:
I''ve already posted this in rails, but someone there suggested this
would be better.
I''m getting a ferret error when I try to delete any item that has been
previously indexed. I just installed ferret, so the indexes aren''t big
or anything. What I''m trying to do is to just delete an item on a table
that has been index. Here''s the error
2009 Jul 16
9
Please help me understand how arrays are translated in rails
I''ve spent hours researching the subject and have tried many test
sequences in IRB, and rails console but I''m just having trouble making
headway into what is probably a very easy subject.
I understand arrays with at least 4 other languages but with Ruby I
haven''t found a mental connection with how I can assign variables to
arrays..
Take for example:
def
2009 Jul 17
19
I need help saving table data from a rake task
I need to find out how I can create and save a large dataset to a table
based on multiple returned arrays from a Rake task.
Here is my example using just two arrays (there are 14 in this
particular rake task):
update_tsos_offense = TsosOffense.new
to_team_id, to_ppcs = update_tsos_offense.calculate_tsos(TotalOffense,
"ydspgm", "desc")
ro_team_id, ro_ppcs =
2008 Mar 08
9
Validation error handling on related models
I have 2 models, entity and client. Entity has_one client and client
belongs_to entity.
Entity has attributes name and legal_name. Entity also has an unique
index on (lower(name)). The pKey for both is the conventional Rails id.
Client has a fKey constraint on entity_id and is indexed in entity_id.
In controllers/clients_controller.rb I have:
# GET /clients/new
# GET /clients/new.xml