similar to: does has_many: add a has_<associated_class>? method

Displaying 20 results from an estimated 3000 matches similar to: "does has_many: add a has_<associated_class>? method"

2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object was newly created? Hopefully this will explain my question: A Firm class declares has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients and a client class declares
2006 May 17
1
capistrano and svn+ssh on non-standard port
Hi, I have ssh configured with a non-standard port, and I use svn+ssh to access to my repository. As the svn+ssh protocol doesn''t support the colon convention to specify the port, I export the SVN_SSH variable in .bashrc, like this... SVN_SSH="ssh -p 2323" Now I can do a checkout from the command like using something like this... svn checkout
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m hoping somebody can set me straight. I have an object AlertTemplate which will contain a fill in the blank style hunk of web content. I then have an object, Alert, which will have a relationship to one of those AlertTemplate objects, plus some data. So, in human speak, I''d think that an Alert
2007 May 14
0
building and saving has_many and has_one relations
Hi, I am very confused about an aspect of has_one and has_many relations, with regard to using the build method, and saving the belongs_to side. It''s a somewhat long post. so please bear with me :) First let''s consider the has_one scenario. Let''s say I have a student who must own exactly one car: class Student has_one(:car) end class Car belongs_to(:student)
2006 Aug 03
12
More than one has_many :through association between the same 2 models
I wonder if you can have more than one has_many :through association between 2 models. For example... I have a model Teacher and a model Class Now, 1 Teacher works in many Classes, right?. So I need a join model like class Work < ActiveRecord::Base belongs_to :teacher belongs_to :class end But I also would like to know if a teacher CAN teach a class before I
2006 Jul 11
1
counter_cache, has_many and belongs_to
I am a bit confused about counter_cache here. The API docs http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html say that only the belongs_to association can take the :counter_cache option. When I try to use it on a has_many I get an "unknown key(s): counter_cache" error. Why would this be the case? belongs_to means that this model has a field with an id
2006 May 02
3
Ordering Results returned by has_many relationship.
Noob Question 31,265,232 if I''m searching on an object, say order, that has many "order_lines" and I want to display order lines by Quantity ( an attribute of the order_lines ) descending how could I do that without having to do a find() with :order, but something like; Order.order_lines.each do |ol| <!-- code to diplay the line --> how can I determine the field
2006 May 05
0
Missing documentation for find_in_collection? Trying to drill down in a 4 level has_many association fails
I''ve been reading up in ActiveRecord::Associations and playing around with my app via the console and found some interesting methods via the code completion of IRB, but I have no idea how to use them and can only find one hint in the API http://api.rubyonrails.com/classes/ActiveRecord/Associations/ ClassMethods.html It mentions here in the has many associations that if you use the
2018 Mar 20
0
Disperse volume recovery and healing
On Tue, Mar 20, 2018 at 5:26 AM, Victor T <hero_of_nothing_1 at hotmail.com> wrote: > That makes sense. In the case of "file damage," it would show up as files > that could not be healed in logfiles or gluster volume heal [volume] info? > If the damage affects more bricks than the volume redundancy, then probably yes. These files or directories will appear in
2007 Nov 22
1
has_many :through questions
I''ve created the following associations using :through: class Person < ActiveRecord::Base has_many :attendees, :dependent => :destroy has_many :events, :through => :attendees, :uniq => true end class Event < ActiveRecord::Base has_many :attendees, :dependent => :destroy has_many :people, :through => :attendees, :uniq => true
2023 May 17
1
[Gluster-devel] Error in gluster v11
On Tue, May 16, 2023 at 4:00?PM Gilberto Ferreira < gilberto.nunes32 at gmail.com> wrote: > Hi again > I just noticed that there is some updates from glusterd > > apt list --upgradable > Listing... Done > glusterfs-client/unknown 11.0-2 amd64 [upgradable from: 11.0-1] > glusterfs-common/unknown 11.0-2 amd64 [upgradable from: 11.0-1] > glusterfs-server/unknown 11.0-2
2018 Mar 18
1
Disperse volume recovery and healing
No. After bringing up one brick and before stopping the next one, you need to be sure that there are no damaged files. You shouldn't reboot a node if "gluster volume heal <volname> info" shows damaged files. What happens in this case then? I'm thinking about a situation where the servers are kept in an environment that we don't control - i.e. the cloud. If the VMs are
2018 Mar 16
0
Disperse volume recovery and healing
On Fri, Mar 16, 2018 at 4:57 AM, Victor T <hero_of_nothing_1 at hotmail.com> wrote: > Xavi, does that mean that even if every node was rebooted one at a time > even without issuing a heal that the volume would have no issues after > running gluster volume heal [volname] when all bricks are back online? > No. After bringing up one brick and before stopping the next one, you need
2023 May 16
1
[Gluster-devel] Error in gluster v11
Ok. No problem. I can test it in a virtual environment. Send me the path. Oh but the way, I don't compile gluster from scratch. I was used the deb file from https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/ --- Gilberto Nunes Ferreira (47) 99676-7530 - Whatsapp / Telegram Em ter., 16 de mai. de 2023 ?s 09:21, Xavi Hernandez <jahernan at redhat.com> escreveu: >
2007 Sep 26
0
activerecord multiple databases
So, I was looking for a setup that would allow me to easily query multiple databases and not have to re-write my customer finder type queries. Here is what I came up with and it seems to be working for me in my very basic tests so I thought I''d share. Just posting it in case this helps anyone else trying to do the same thing. I''m using this with activerecord, but not rails, so
2023 May 16
1
[Gluster-devel] Error in gluster v11
Hi again I just noticed that there is some updates from glusterd apt list --upgradable Listing... Done glusterfs-client/unknown 11.0-2 amd64 [upgradable from: 11.0-1] glusterfs-common/unknown 11.0-2 amd64 [upgradable from: 11.0-1] glusterfs-server/unknown 11.0-2 amd64 [upgradable from: 11.0-1] libgfapi0/unknown 11.0-2 amd64 [upgradable from: 11.0-1] libgfchangelog0/unknown 11.0-2 amd64
2007 Jan 17
1
include ClassMethods in plugins
Why is that in so many plugins I see people using (including acts_as_taggable by DHH): # init.rb ActiveRecord::Base.send(:include, ActiveRecord::Acts::SomeModule) # lib/some_module.rb module ActiveRecord module Acts module SomeModule def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_something # code
2006 Jul 20
5
How can I make has_many prevent a delete that would lead to orphans?
e.g. class Asset < ActiveRecord::Base validates_presence_of :asset_number, :make, :model, :location, :name, :serial_number validates_numericality_of :asset_number validates_uniqueness_of :asset_number belongs_to :user belongs_to :location belongs_to :asset_type, :foreign_key => ''type_id'' end class Location < ActiveRecord::Base validates_presence_of :name
2023 May 16
1
[Gluster-devel] Error in gluster v11
Hi Gilberto, On Tue, May 16, 2023 at 12:56?PM Gilberto Ferreira < gilberto.nunes32 at gmail.com> wrote: > Hi Xavi > That's depend. Is it safe? I have this env production you know??? > It should be safe, but I wouldn't test it on production. Can't you try it in any test environment before ? Xavi > > --- > Gilberto Nunes Ferreira > (47) 99676-7530 -
2012 Sep 28
0
Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
I have: module MySpike extend ActiveSupport::Concern included do class_attribute :foobar, instance_writer: true end end But, I want to be able to override the class attribute writer and/or instance writer method to do something when the attribute is set via self.foobar = true before or after calling super to set the attribute. Unfortunately, I can''t find a clean way