Displaying 20 results from an estimated 1000 matches similar to: "Editiing multiple has_many associations at once"
2006 Jul 24
1
problem with has_many associations
Hi all,
I have some problems with a few temporary objects, this is the relation
between them:
A -(1,n)-> B -(1,1)-> C
B -(1,n)-> D
C -(1,n)-> D
I have a "wizard" to create "A" objects, I''m storing everything in the
session, something like this:
a = A.new
session[:a_object] = a
...
b = B.new
b.c = some_c_instace
a.bs << b
...
d = D.new
b.ds
2006 Apr 04
1
Manipulating has_many :through associations
Hi,
I haven''t done any associations before, so please forgive my incorrect
use of terminology...
If I set up a has_many :through association, can I manipulate the
associated instances directly (like an Array), or do I need to
manipulate the join model?
For example, suppose I have two classes and the associated join model:
class foo
has_many :foo_bars
has_many :bars, :through
2006 Mar 24
2
Change to has_many :through associations
Hi everyone. I''ve made a default change to has_many :through
associations that I felt was important to make before they''re
released. This is after some tickets and confusion I''ve seen
regarding has_many :through.
class Connection < ActiveRecord::Base
belongs_to :user
belongs_to :channel
end
class Channel < ActiveRecord::Base
has_many :connections
2006 Feb 03
1
nested has_many associations
My question is whether the rails helper methods for handling associations can
be nested (see examples below). I suspect not as currently I''m
getting "unknown method" if I try and use two associations in one call.
The essence of the code is
class User << ActiveRecord::Base
has_many :items
class Items << ActiveRecord::Base
has_many :reservations
belongs_to
2006 Jan 30
0
Serializing has_many associations and ActiveRecord objects
Is it possible to serialize ActiveRecord objects and ActiveRecord
children to XML?
--
Posted via http://www.ruby-forum.com/.
2009 Aug 01
0
Nested forms and deleting/removing has_many associations
I am using nested forms on person model that has many pictures.
I would like to allow the user to remove on or more of the associated
pictures from the person using nested forms as suggested by Ryan Bates.
However delete will delete the picture not remove the associatioon
I can do it in the controller, but it should be done in the same way as
delete is performed using attribute _delete
Anyone
2009 Jan 22
0
ActiveLdap belongs_to and has_many associations
Hi,
I am trying to use ActiveLdap for authentication in my rails app. But I
am running into a problem with the "belongs_to" and "has_many"
associations.
Here ist how my models look like.
class Person < ActiveLdap::Base
ldap_mapping :dn_attribute => "uid",
:prefix => "ou=People",
:classes =>
2009 Mar 13
1
Problem saving nested attributes for has_many associations (Rails 2.3 RC2 and Edge)
I''ve tested this on both 2.3 RC2 and Edge. This pastie contains
model, helper and view: http://pastie.org/415742
When I save a vocabulary - its terms don''t save. I''m fairly sure it
worked in RC1. Would appreciate any insight.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2009 May 27
0
Nested Forms with has_many associations with validations
I want to have a parent model that I can add child objects (via a
has_many association) using the rails 2.3 nested form syntax. However,
it seems like rails throws an error during validation of the parent
model if I have a validates_presence_of :parent_id defined in the child
model.
Is the only solution to this to remove the validates_presence_of
:parent_id? This seems like a hack-ish workaround.
2009 Feb 26
0
Using form_for and has_many associations with a controller in its own subdirectory
Hi,
I''m trying to create a Blog in it''s own subdirectory for an E-commerce
site. Everything is hooked up just fine for the basic posting, but
when I try to add Comments, I''m getting all sorts of headaches! I''m
referring to the screencast by Ryan Bates on the rubyonrails.org site.
Basically, my controller is Blog::Comments, in my Blog::Post comment
form I have
2006 Jun 13
0
question about saving associations when using has_many :through
I''ve got a User model and a Book model. A user is required to submit
books each month to be reviewed by other users. I have the following
relationships defined:
# the join model
book_review.rb
belongs_to :user
belongs_to :book
end
book.rb
# each book is reviewed by many users. This allows us to get the BookReview
# objects associated with this book
has_many :book_reviews,
2011 Jul 26
1
ActiveRecord has_many associations
Given the models Country, State, City and Person as follows.
class Country < ActiveRecord::Base
has_many :states
end
class State < ActiveRecord::Base
belongs_to :country
has_many :cities
end
class City < ActiveRecord::Base
belongs_to :state
has_many :people
end
class Person < ActiveRecord::Base
belongs_to :city
end
Is there any way that doesn''t allow to delete
2006 Aug 16
1
Naming rights_roles join model using has_many :through and polymorphic associations
Hi.
I have a couple of best practices questions regarding polymorphic
associations, naming join tables and user permissions.
Currently I have implemented the user authentication model from the
rails recipes book. Basically it goes something like this:
MODEL CLASSES:
class User < ActiveRecord::Base
has_and_belongs_to_many :roles
end
class Role < ActiveRecord::Base
2006 Sep 03
1
New Technique: Subsets of has_many Associations
I just now thought of this, and sure enough it works like a charm (at
least so far in my limited testing):
has_many :events, :dependent => :delete_all
has_many :upcoming_events, :class_name => "Event", :conditions =>
"date > NOW()"
The purpose of this is that it makes eager loading of subsets of
associations possible without replacing all the magic of the
2008 Apr 24
2
Dynamic finders in has_many associations
I have these 3 models.
class Ivr < ActiveRecord::Base
has_many :klusterings, :dependent => :destroy
has_many :klusters, :through => :klusterings, :uniq => true
end
class Kluster < ActiveRecord::Base
has_many :klusterings, :dependent => :destroy
has_many :ivrs, :through => :klusterings, :uniq => true
end
class Klustering < ActiveRecord::Base
belongs_to :kluster
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
Considering an object with several has_many :through => associations,
what is the ''best'' way to handle validations?
As an example:
class Student < ActiveRecord::Base
# some attrbutes like
# :name
# :grade
# relationships
has_many :students_assignment, :dependent => :destroy
has_many :assignments, :through => :students_assignment
has_many
2007 Jun 15
1
c2d E6600 + $ GB RAM fits?
Hi,
I want to use xen 3.1 on debian 4.0 (etch) in order to have Win XP,
OpenSolaris, FreeBSD, NetBSD as guest os.
Could you tell me if tell following hardware will fit fore this purpose
(system is used for development)?
Intel Core 2 Duo E6600, 4 GB RAM, 4x WD 1600AAJS (RAID 0+1), ASUS EN7600 Top
Silent/HTD
It would also be interessting for me if it will sufficent work (preformance)
if I do
2011 Sep 13
2
Reading R Code aloud
Dearfolks--
I have been told by an experienced R programmer and teacher whom I trust
that it is easier to understand R code if you read it aloud, as the language
that it is. However, she was clear that reading it aloud was not simply
reading the marks on the screen: you read A.df[5,] as "the fifth row of
A.df" (or "the fifth row of data frame A"), not as "A dot df left
2006 Apr 20
3
has_many :through with has_many/has_many join models
It seems that using a join model that joins with two has_many''s will
fail to generate proper SQL
class StudentSemesterRecord < ActiveRecord::Base
belongs_to :semester
has_many :discipline_records, :through => :semester
end
class Semester < ActiveRecord::Base
has_many :student_semester_records
has_many :discipline_records
end
class DisciplineRecord <
2019 Nov 04
0
Centos 8 IAM
> Op 4 nov. 2019 om 13:14 heeft Per Qvindesland <perq at me.com> het volgende geschreven:
>
> Is there any plans to release a official AMI for Centos 8 soon?
I?ve been trying to get information about this since FOSDEM 2019 last year. I offered help, reached out to multiple twitter accounts, visited the Centos community day before FOSDEM in January 2019 hoping to get this process