Displaying 20 results from an estimated 10000 matches similar to: "how to delete a parent record and child records?"
2009 May 14
3
Mysql query is not working
Please,
Can anyone help me to execute this query?
SELECT * FROM table WHERE customer_id IN (SELECT IF(1 <> 2,''SELECT
customer_id FROM customers'',''SELECT customer_id FROM company''))
Regards...
--
Posted via http://www.ruby-forum.com/.
2009 Oct 29
4
Unknown column 'quotes.organisation_id' in 'where clause': SELECT * FROM `quotes` WHERE (`quotes`.organisation_id = 1036)
Hi,
I have a small app that needs to keep track of quotes, and
organisations. An organisation can either be the unit who finally
receives the goods (the end_user) or and intermediary (customer) (and in
some cases both)
An Organisation will (hopefully :) ) have many quotes; and a quote
can belong to an organisation, either as a customer or as an end_user or
both.
So the quotes table
2006 Apr 03
1
Single table inheritance and relations
All,
I''ve a question concerning STI in Rails. Let''s say I''ve a Person class
and two classes that inherit from Person: User and Customer. In the DB
I''ve the people table to store both instances of User and Customer.
Now, let''s say I also have Address class, which references a Customer,
and each customer has many addresses. How should I name the
2006 Jan 13
4
Single Table Inheritance (this is my 3rd post :( )
Hi Everyone,
I hope I get some feedback on my question. Here it goes.
I have a situation here, I have a company table and then using Single
Table inheritance it is of 3 types:
class Company < ActiveRecord::Base
end
class Vendor < Company
end
class Customer < Company
end
class Agent < Company
end
Now I have a active record Association
class QuoteSheet < ActiveRecord::Base
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
2008 Jul 17
2
Add a SQL Statement to every query
Hi,
im trying to create an application for multiple customers, where data
shouldnt be accessible to others. So ive added a customer_id to every
db-table where it matters.
Question: How can i add a Statement to find and other sql-commands so
i just pull out the ones belong to the customer, without having to
add :customer => customer to every find query? Whats the easiest way?
a before_filter
2006 Jul 25
2
Authentication design/ideas
Hi all,
I''m using acts_as_authenticated for the front end facing part of my
site. I have a model called Customer. I now want to protect the admin
sides of things. I am thinking of using Ezra''s acl plugin
(http://opensvn.csie.org/ezra/rails/plugins/dev/acl_system2/README)
for this. My only problem is that I don''t want the model for admin
users to be called Customer,
2007 Sep 05
8
Hi..Guys new plugin again
Hi..
Guys new plugin again
Foreign Key Associations is a plugin that automatically creates
associations based on foreign-keys. The associations are created at
runtime-ie. as your ActiveRecord models are loaded-so they will always
be up-to-date.
For example, given a foreign-key from a customer_id column in an
orders table to an id column in a customers table, the plugin
creates:
2006 Jul 23
2
how to paginate child records
hi
i know i can do:
@customer_pages, @customers = paginate :customers, :per_page => 8
but these customers have helpdesk calls which are child records. I hoped
i could do something like paginate customers.calls, but dat doesn''t work
what is the best way to get a paginated list of child records?
remco
--
Posted via http://www.ruby-forum.com/.
2008 Sep 02
5
Appending a record to a table
Hi
I''m not too sure how best to explain this but here goes!
I am trying to write an appointment system. I have, through example,
just about got the dynamics correct. Even tried to play with some
table joins (and excuse me if I''ve used the incorrect terminlogy). But
no matter what I try I can''t seem to get the following code to work.
I have a cart filled with Treatment
2011 Sep 25
4
checkbox use question
Hi,
how can I use checkbox in a form to show all customers from table
customers,
Course Users Customers
========= ========= =============
user_id customer_id Customer_name
I would like to select customers from the checkbox list, then add to the
course table only users of the selected customers.
thanks dani
--
Posted via http://www.ruby-forum.com/.
--
You received
2006 Mar 29
2
save related models from one form
I have three tables customers, indentities and people. I hav ecreated
models for them. The are connected with foreign keys and
has_many/belongs_to in this fashion:
customers has_many: identities
identities belongs_to: customer
identities has_many: people
people belongs_to: identities
Now, I have a form in which I would like to create db entries for the
three tables. customers have a password
2007 Jan 08
1
Realtime Voicemail Table Column Name Question
Hi All,
In the realtime voicemail table the column 'customer_id' is used, for
my purpose, to specify the customers accountcode. The column name
'accountcode' is used in the iax and sip tables. To keep this
consistent throughout the tables, is there any reason I should NOT
switch the column name 'customer_id' to 'accountcode' in the voicemail
table? Does Asterisk
2007 Sep 21
2
ActionWebServer and SOAPFault
I''m really new to RoR and my first task is to write SOAP web service.
The problem is that I don''t understand how to send custom SOAPFault
messages in case of the errors.
For example, I have FindCustomerById API signature:
api_method :find_customer_by_id,
:expects => [{:customer_id => :int}],
:returns => [Customer]
And controller:
def
2008 Feb 22
4
has_many and belongs_to in rails 2.0.2 (child.Parent) is not working
Hi All
I have 2 models working well in rails 1.2.6 :
class TypeService < ActiveRecord::Base
has_many :Services
end
class Service < ActiveRecord::Base
belongs_to :TypeService
end
I was able to get the name of the service with Rails 1.2.3:
s = Service.find(1)
name_type_service = s.TypeService.name <<-- Now with rails 2.0.2
that doesn''t work
With rails 2.0.2
s
2006 Jun 24
2
:limit => Parent / Child Relationship
Hi all,
I trying to find the best way to do the following and I''ll use a blog
with comments for an example.
Blog has many comments
Comments belongs to blog
My question is how to limit the number of comments (child) records read
for each blog (parent) record. Most of the solutions I''ve come up with
are limiting the number of records displayed within the views but the
2007 Mar 07
4
Strange Problem With Unwanted, Transient Caching
Hello,
I hope somebody can explain to me what''s going on here because I''m
baffled!
In a controller''s action I want to create a new order for a
customer. Because I post back to the same action (not RESTful I
know, but that''s for another day) I use code like this:
def edit
@order = Order.find_by_id(params[:id]) || Order.new
...
end
I
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
In part of my application I''m using dynamic tables. I''m aware of the single
thread conditions. I''ve tackled some caveats yet - will post a blog about
it soon - but there''s one I need help with.
Consider 2 models that are associated: Order and OrderLine where Order has
many order_lines.
Now we set the table names for them:
2006 Apr 12
2
ActiveRecord Parent-Child relationship bug? config problem?
If i have a parent that has_many :children, and the child belongs_to
:parent. Then when I add a new child to the parent like so:
parent.children << Child.new, then shouldn''t the child also have a
reference to the parent? but it doesn''t-- child.parent is nil-- what''s
going on here? is this as it should be-- shouldn''t it have a reference
to the
2005 Dec 07
3
ActiveRecord::Observer problem
Hi all,
I have a problem with an observer. I have a simple observer...
class ActivityObserver < ActiveRecord::Observer
observe Customer
def after_create(model)
bind_params(model)
@al.action = "create"
@al.save
logger "#{model.id} : created"
end
private
def bind_params(model)
@al = ActivityLog.new
@al.user_id = User.current.id