Displaying 20 results from an estimated 1000 matches similar to: "Problem with has_many"
2005 Dec 19
4
need some help designing my messaging system
I am trying to create a messaging system for my users but I''m having a
hard time designing my db. This is what i have in mind, but I am not
sure if its the best approach.
user has_one inbox
user has_one outbox
inbox has_many messages
outbox has_many messages
inbox table
user_id
outbox table
user_id
messages table
box_id (refers to either inbox or outbox - how?)
from_id
to_id
2005 Nov 21
2
Multiple user_id columns
I have a table called ''users''. I have a second table called ''comments''.
The comments table is in need of _two_ columns that both reference
different user ids within the ''users'' table (one column for the user id
that originated the post, another column for the user id for which the
message is intended for.
Obviously I can''t create
2012 Feb 14
2
Model with 2 foreign keys
Hi All,
I''d like to integrate a simple user-oriented messaging system into my
app.
I have a Message model, with :from_user_id, and :to_user_id (for the
user that sent and the user that recieved the message).
Obivously, (User) has_many :messages will fetch the messages that a
certain user has created, but not the ones that they have been sent.
Currently, I have this:
has_many :messages,
2009 May 29
4
logical vector as a matrix
I have a vector like this:
h <- c(4, 6, NA, 12)
and I create the secound logical vector like this:
g <- c(TRUE, TRUE, FALSE, TRUE)
And my problem is that I would like to get a new "m" vector as a rasult "h"
and "g"( as dot-matrix printer) but with missed "NA" value, for example:
m = (4,6,12)
Do you have any idea?
--
View this message in
2009 Aug 23
2
difficult "for"
Hi,
My english isn't brilliant and my problem is very difficult to describe but
I try ;)
My first question is: May I write loop "for" like this or similar - for (i
in sth : sth[length(sth)], k in sth_else : length(sth_else) ) - I'd like
to have two independent conditions in the same loop "for".
My secound question depend on program below. I'd like to write every
2009 Jan 23
4
Postfix and Dovecot
Hi Everybody,
I'm mount two failover servers which use Postfix and Dovecot but the
hostname of the machines r diferent:
first node
# uname -n
# mail
secound node
#uname -n
#mail2
So far so good, the real problem is that the e-mail file name on server is
like this:
1232449377.P31789Q0M963611.mail2
and when I using the server called mail the file stay like this:
2006 Jul 23
4
has_many AND has_many :through ?
Hi,
I am working on a scheduling app and I have a perpelextion (new word).
I am wondering if the problem is my data model
I have Users.
Users can create Events.
Users can be invited to Events created by other Users.
So...
user.rb
class User < ActiveRecord::Base
has_many :invitations # invitations to other users'' events
has_many :events, :through => :invitations # all events
2009 Sep 29
6
Dualboot CentOS and Windows
Hi,
I have to install CentOS on a spare partition of a laptop with
Windows pre installed. Is there anything I have to watch out for?
Couldn't find anything in the wiki or does the installer handle this
well without me doing some magic, or so?
TIA,
Frank.
2005 Apr 27
4
has_many syntax
Hi all,
I have the following inside of an AR class definition:
relationships=ActiveRecord::Base.connection.select_all(my_relationships_sql)
relationships.each do |relationship|
has_many RelatedItems, :class_name => relationship[''RelatedClass''],
:foreign_key => relationship[''ForeignKey'']
end
This kind of works, but how can I assign the name of the
2006 Aug 02
2
Self-Referential has_many :through
Hello all.
I am trying to create a self-referential has_many :through. I used the
following site as a guide
http://blog.hasmanythrough.com/articles/2006/04/21/self-referential-through
but it still doesn''t appear to be working. I have two models. Person and
Relationship. A person has many contacts (Which is another person)
through relationships
class Person < ActiveRecord::Base
2006 Apr 21
3
polymorphic,has_many through can not work?
Josh Susser tells in his blog that the opposite direction of polymorphic
will get into trouble together with has_many through.
This is the url:
http://blog.hasmanythrough.com/articles/2006/04/03/polymorphic-through
I do that according to Josh Susser''s procedure:
class Tagging < ActiveRecord::Base
belongs_to :tag
belongs_to :taggable, :polymorphic => true
belongs_to
2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table
has another "non-joiny" attribute.
I went from this:
has_many_and_belongs_to :jobs, :join_table => ''tablename'',
:foreign_key => ''x'',
:association_foreign_key => ''y''
to this:
has_many :jobs, :through =>
2008 Jun 13
6
Newbie question on has_many
I have two classes: a Widget and a User. The User has an id that is
referenced in two places on the Widget: owner_id and operator_id.
How should I structure that reference for has_many?
Thanks folks - I appreciate any help on this.
--David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2011 Jan 15
3
has_many :through with Single Table inheritance
I have the following model structure setup.
class User < ActiveRecord::Base
end
class Parent < User
has_many :relationships
has_many :children,
:class_name => "Student",
:through => :relationships,
:conditions => "related_as = ''parent''"
end
class Student < User
has_many :relationships
2006 Apr 25
3
belongs_to and has_many
I know this has been rehashed many times, but I don''t get it.
I can''t find it documented to were I understand all the parts. I can
make this work using Rails database design conventions, but in this case
I am not able to do that.
I find examples, but the ones I find do not follow the conventions.
They also do not give enough information to understand what is going on.
In
2017 Nov 15
4
How to blacklist a device driver (sysemd)
Hi,
how can a specific device driver in CentOS 7 be blacklisted, so that it
doesn't load at boot time? We have Infiniband adapters which are not
completely supported by CentOS and we want to silence the error messages
for the time being.
I tried with the files
/etc/modprobe.d/blacklist
/etc/modprobe.d/blacklist.conf
and with entries
mlx5_core
mlx5_ib
blacklist
2018 Jun 06
3
Firefox and Thunderbird freeze/crash followed by "nfs4_reclaim_open_state: Lock reclaim failed!" syslog messages
Hi,
since I updated my workstation from CentOS 7.4 to 7.5, Firefox and
Thunderbird (both 52.8.0, from CentOS repos) regularly freeze (or crash)
and cannot be restarted afterwards. Trying to start them results in a
"Bus error (core dumped)" (Firefox) and "Killed" (Thunderbird). The
system log then shows:
kernel: NFS: nfs4_reclaim_open_state: Lock reclaim failed!
2006 May 23
7
self-referencing has_many
Having a devil of a time finding records in a self-referencing has_many
table relationship.
Everything is working find looking at the has_many and the belongs_to
relationship.
But, when I try to find all "orphans", records that are neither a parent
nor a child, I can not find a query that work in ActiveRecord.
This query works in MySQL:
SELECT * FROM templates
LEFT JOIN templates
2006 Apr 03
2
Problems with STI in has_many/belongs_to in Rails 1.1
I have a problem that surfaced in my attempt to upgrade my application
to Rails 1.1.
We have a STI model on the "belongs_to" side of a has_many/belongs_to
relationship. All my unit tests for this model pass, and the
relationships all seem to work fine.
But in my functional tests, I''m getting errors. I''ve traced it back
into the call to the has_many
2018 Oct 29
4
PostgreSQL port accessible even though it should be blocked by firewall
Hi,
this puzzles me: On one of our developer workstations, all ports with
the exception of SSH are closed:
$ firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eno1
sources:
services: ssh dhcpv6-client
ports: 22/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
$
but still port