similar to: Please Help with single table inheritance relationships

Displaying 20 results from an estimated 300 matches similar to: "Please Help with single table inheritance relationships"

2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models: class Order < ActiveRecord::Base belongs_to :billing_address belongs_to :shipping_address accepts_nested_attributes_for :billing_address accepts_nested_attributes_for :shipping_address, :reject_if => proc { |attributes| attributes[''has_shipping_address''] != ''1'' } def after_initialize self.build_billing_address
2005 Sep 29
0
Table relationships with single table inheritance
Hi, How do I relate a table to another when one of the models uses single table inheritance? Will this even work? This is the specific problem I am having: There''s an "Address" model with "ShippingAddress" and "BillingAddress" as subclasses. It looks like this: class Address < ActiveRecord::Base End class ShippingAddress < Address has_one :order
2007 Nov 20
2
confirming that a model instance was correctly created from POST params
I''m wondering whether I''m wasting my time trying to verify that an addition I''ve made to legacy code is in fact setting a new attribute on a model. Substruct''s (http://dev.subimage.com/projects/substruct) OrderHelper contains this method: 1 def create_order_from_post 2 @use_separate_shipping_address = params[:use_separate_shipping_address]
2006 Jun 01
4
how can I control when to commit a transaction?
hello it seems like this question has appeared a few times with no answer: how do you get rails to issue ''write'' statements (ie ''CREATE/UPDATE'') to the database without committing each time? I tried setting ActiveRecord::Base.connection.begin_db_transaction before calling any action on my object, but as soon as myObject.save or myObject.update is called,
2006 Apr 04
4
Aggregating two objects of the same type
I would like to have a customer that has references to two addresses, a billing address and a shipping address. In a non-rails environment I would have two keys in the customers table, billing_address_id and shipping_address_id to reference the addresses. It appears that ActiveRecord expects the parent id to reside in the child table, regardless of whether the relationship is one-to-one or
2010 May 10
7
NilClass passed to partial view
Hi, I have a simple program that tries to do something really basic. First, I have a company Model : ------------------------------------- class Company < ActiveRecord::Base has_one :billingAddress, :foreign_key=>"id", :class_name=>"Address" end Then I have the address Model : -------------------------------------- class Address< ActiveRecord::Base belongs_to
2008 Jul 07
0
ActiveRecord in Rails 2.1.0 misbehaving for Aggregate Attr.
I am not sure if this is a bug in ActiveRecord or is this the intended behavior. If it is then it does not make sense to me. In a nutshell: If you change an aggregate object attribute created via composed_of method (see Agile Web Development - Second Edition Chapter 17 page 313 onwards) and then save the model, the change to the model (composite attribute specifically) will not be saved UNLESS
2008 Dec 02
4
Am I wrong or is fields_for not working right in Rails 2.2.2
I may be totally wrong about what the fields_for method is supposed to do, but for some reason I thought using it scoped an object around an association. For example, I have a User class and when you''re creating a new user I want to use fields_for to add a BillingAddress to the user like so: <%- fields_for :billing_address do |billing_address_form| -%> <%= render :partial
2009 Feb 26
1
composed_of, aggregate object isn't saved
I am relatively new to rails and I cannot figure out what is going on here. I am using the composed_of method in an ActiveRecord class to create two aggregate properties: shipping_address and billing_address. The object properties are getting populated from the form and validation is working - no problem. When I call order.save, though, everything is being saved except the address fields. I am not
2006 Jul 30
3
ActiveRecord - Multiple Address for a single record
I''m trying to figure out the Rails way to model the following problem: I have 2 tables. One (let''s call it location) contains a single address. The other (let''s call it company) contains 3 address. I''m trying to figure out the best way to model this. I''ve created an address table, a set up the model as follows: class Address <
2006 Apr 08
2
one-to-one relationship confusion
Hello, I posted a similar email, earlier in the week, but I still must not be getting it. I have a customer that aggregates two addresses; a shipping address and a billing address. Addresses can also be referenced by other objects in a similar way, so I would really like to avoid putting the keys referencing the customer or other objects in the addresses table. Addresses are exclusively
2006 Aug 02
3
Data relationships for e-commerce: users, orders, addresses
Hi there I''m in the process of developing an e-commerce Rails app but am getting a little stuck on what models I should be working with on the order/checkout side of things. The app requires users to be registered and authenticated to checkout. So I already have a User model and an Order model (which belongs to a User). The Order model is largely similar to that used in the Agile Rails
2013 Oct 02
4
"Enterprise Class Hard Drive" - Scam Warning
Hi All, I know many of us here manage RAID on our Centos based servers so this may be of interest to us all. I ordered three new "Enterprise hard drives" this month from a well known UK online retailer. The drives arrived as new in their anti-static packaging. Before using one of the drives in a mission critical hardware raid I checked the SMART attributes and was amazed at what I
2006 May 04
22
Should controllers be "smart"?
I''m working on a small project with a friend, and one of the things we needed to do was send off an email whenever someone signs up an account. His implementation was pretty simple - throw a deliver_welcome call inside the controller after the signup. I''m sure that this is a pretty common thing to do. The problem, in my mind, was that the app now became tied to two places -
2007 Aug 02
2
TE220B
Hi, Has anyone ever had any problem with the TE220B card with it showing up as four ports instead of two. I RMA'd the first one with the retailer (Digium tech advice), but I just got another brand new card and it is coming up as four ports again. The card identifier is showing 0420 when I do lspci. Has this happened to anyone and if so is there a fix? Remi
2009 Jan 12
1
re tail case-pack ordering problem - can R help?
I'm a programmer, not a mathmatician. I heard about R, and I'm wondering if anyone can tell me if there is an existing R function that can help with a problem we're currently trying to find an algorithm for. If R is not the answer, but you can recommend a known algorithm, that would help a lot! I'm on a project in a retail corporation, working on a program to assist retail buyers
2006 Apr 18
4
ISDN in Japan?
Hi all, general query here --- I'm about to set up an asterisk box for use in Japan but can't figureout if it's all ISDN there or what? I have gathered so far that the two major providers, NTT and KVH both offer ISDN lines with .......INS1500 and maybe INS64 protocols? Not sure... But I'm seeing stuff about J1 vs. T1/E1 .... so does that mean I can't use a Digium card it
2006 Jul 09
17
Has many / belongs to error with mysql
Hi, I''ve got stuck with a problem on my rails app - I''ve created a database for quotes and bookings, with a futher table "eventdetails" (details of a quote or booking) linked one-one for both tables using a polymorphic assciation. This all works, but I am now trying to link a quote to a number of bookings with a has_many and belongs_to (the foreign key is in the
2005 Sep 27
2
IAX2 hard phone
I purchased an IAX2 hardphone, X100 otherwise known as a Netweb X100 or YWH100 with a PA168 chip and the latest firmware 1.45 available, from a US retailer. I was able to configure the phone to work with my Asterisk box, except the hold and transfer buttons do not work. When you press the hold button, it rings endlessly, the transfer button, displays "transferring" but it does nothing.
2005 Jul 24
2
Busy Lamp Field SIP Phone
Does anyone have a recommendation for a good SIP phone with a busy lamp field? I need my operator to be able to see extension status for about 20 extensions and transfer via HOLD + extension button. I've got a pair of SNOM 360s with the sidecar, but I'm very disappointed with them. The buttons are cheap and rubbery like a Sipura 841, the handset cord is short and cheap, the audio quality