Displaying 20 results from an estimated 7000 matches similar to: "existing magic to prevent db redundancy?"
2006 May 14
4
searching on foreing keys
Hey all,
I''m using a simple search function. It''s working
great except for foreign keys.
I have one table pets (id,name,owner_id)
and another table people(id,name)
owner_id being a foreign key of pet pointing to people name.
here it is on the pet controller:
@paginator, @pets= paginate(:pets, :conditions =>["name OR owner_id
like
2006 Jul 10
18
Deleting join association of has_many :through
I''m trying to use has_many :through, since my join model deserves being
more than just an intersection table.
But when I try to break the association, the break only seems
"temporary":
Let''s say my two tables are Users and Colors, and the join model is
Favorites.
user = Users.find(1)
user.colors.length
>> 2
c = user.colors.first
>> #<Color:....>
2004 Dec 29
3
inclusion of figlet source
Why is figlet source included in xen? Wouldn''t it make more sense to alter
xen/Makefile, to have compile.h built from a .in, and the figlet view of the
version info, and have the upstream developers regen the figlet part when the
version changes?
I''m willing to modify the build system to do this. I''m also fixing several
other poor implementation of things.
2013 Sep 12
10
[PATCH] xen/build: Remove hacked up version of figlet
This hacked up version of figlet contributes a supprisingly large proportion
of the Coverity issues found under xen/ (and therefore attributed against Xen)
Figlet can be found in all distros, so make use of it.
We keep xen.flf (being the Xen figlet font) and replace the hacked up octal
transform with a short python script.
The Xen Makefile has been tweaked in such a way that it still prints the
2008 Feb 28
2
change drop down list to radio buttons
In my RoR app I would like to change a drop down list, which dispays a
list of colors selected from the database. Instead I would like to
create a radio button for each color. The user is allowed to check one
color and this will be saved back into the database as the color for
this user.
I don''t know how to do this. Currently it looks like this:
<%= select(:user, :color_id,
2012 Sep 21
4
Good resource for the history of activerecord association method naming?
Someone asked me about the history of the method naming in activerecord and
I wasn''t sure where to point them. For example, there was early criticism
noted of has_and_belongs_to_many in this old post from 2005:
http://hans.fugal.net/blog/2005/10/03/habtm/
I was mentioning that many_to_many is not used because there are a few
different ways of doing that via has_many :through and
2006 Jun 14
3
Prevent duplicate HABTM associations
Hi,
I am trying to restrict duplicate has_and_belongs_to_many associations.
I tried to find support for a association validation for duplicates but
couldn''t find anything.
I understand I could use :uniq=>true on the model association but this
would only prevent it from displaying duplicates, I want to stop
duplicate associations being inserted in the first place.
I have a vague
2006 Mar 22
3
Parent-Child Tables Help
can someone help me with this
i have a table
cars
(
id int
model_id int
make_id int
color_id int
description text
constraint fk_cars_carmake foreign key(make_id) references
carmakes(id),
constraint fk_cars_carmodel foreign key(model_id) references
carmodels(id),
constraint fk_cars_color foreign key(color_id) references colors(id)
)
carmakes
(
id int
carmake varchar
)
carmodels
(
id
2006 Jan 02
5
DB Modelling the Rails way - Opinions??
Hi,
I''m trying to figure the most efficient way to model the following. I
can think of at least two ways to relate the tables but from a
client/server perspective! I''m wondering how to best (and
elegantly)relate them from an AR perspective.
A project has many people,
A person can work on many projects at any time,
A project has many roles,
A role is performed by a person,
A
2006 May 05
6
PAE mode mismatch in Xen (xen=no Dom0=yes)
Hi,
I just added 32GB memory in my system and wanted Xen to see that memory, so enabled PAE in xen0 and XenU. I did a make menuconfig in xen0 and xenU, then did a make in xen-unstable and a make install.
Whilebooting this kernel, I get the above error PAE mode mismatch. I looked under xen/include/asm-x86/processor.h has #define X86_CR4_PAE defined and so does cpufeature.h have this defined.
2005 Oct 06
3
Xen unstable/SuSE 9.3 install issue
Hi,
I have successfully installed Xen unstable binary on SuSE 9.3. I am trying
to do a source install and I got the following error. Will be glad for any
help or guidance.
In file included from include/asm-xen/asm/processor.h:18,
from include/asm/thread_info.h:17,
from include/linux/thread_info.h:21,
from include/linux/spinlock.h:12,
from include/linux/capability.h:45,
from
2005 Dec 23
6
Stories with many tags, tags with many stories, has_and_belongs_to_many howto?
Hi,
I began experimenting with habtm relationships, and so I created a
stories table, a tags table, and a stories_tags table referencing the
former 2.
When I create a "story", I want to add several tags to it. Then, the
model should create those tags and link them to the respective stories,
and for the tags that already exists, just link them to the story.
I tried something like
2006 May 08
8
enforcing special behavior of child rows in HABTM
Hi,
I have a scenario where a doctor can have one or more specialties.
For each doctor, one and only one of her specialties can be designated
as primary.
So I have tables called doctors, specialties, and doctors_specialties,
the last of which has a boolean is_primary column.
The doctor model class specifies that:
has_and_belongs_to_many :specialties
I want to enforce, at the lowest possible
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
Hi everyone,
I''ve tried posting the same question to the list last Friday but
somehow did not see it being posted..
I''ve just started with Rails and Ruby. I just started to play one of
those RPG and to get my feet wet I''m writing an app to keep track of
item fusions. So the scoop is that item can be fused with another
items to create a higher level item. The higher
2005 Oct 05
3
Shopping Cart: SKU and Product Confusion
Hi there,
I''m at a loss...
I was on the #ROR channel last night and spoke to a really helpful person
(Defiler) who gave me some direction on building a shopping cart.
Unfortunately, I wasn''t able to successfully get to where I need to go. This
is the predicament I am currently finding myself in:
I''m building a shopping cart for a client''s new website. They
2006 Jan 28
6
Check if user is in right group
What is the best way of checking this?
I have 3 tables:
groups
users
group_members
class GroupMember < ActiveRecord::Base
belongs_to :group
belongs_to :user
validates_uniqueness_of :user_id, :scope => "group_id"
Then I want a method here that checks if a given user is a member of a
given group. What is the right way of doing that?
def
2006 Jan 10
5
Noob ActiveRecord Join Question
I''m new to rails and ruby, and after trying to get this to work
correctly for hours, I thought I''d give this forum an try.
I''ve setup a trivial project just to mess around with Rails database
naming conventions and associations.
I''ve got a table called Pets, and a table called Types.
Pets contains a list of pets, Parky the cat, Daisy the dog, etc, And
Types
2006 Dec 02
2
Strict STI?
Is there a way to set the base class to abstract? or otherwise enforce
that no one can create a "Pet"?
Pet < ActiveRecord
Dog < Pet
Pig < Pet
I''ve tried:
class Pet < ActiveRecord::Base
validates_presence_of :type
end
but I get an error about
../vendor/rails/activerecord/lib/active_record/validations.rb:74:
warning: Object#type is deprecated; use Object#class
2008 May 13
0
[LLVMdev] Python bindings available.
On Tue, May 13, 2008 at 1:22 PM, Gordon Henriksen
<gordonhenriksen at mac.com> wrote:
> On 2008-05-13, at 02:12, Mahadevan R wrote:
>
> >>> That's not how the object works...
> >
> > Gordon, I think I can make it work if we have the following additional
> > function in LLVM-C:
> >
> > LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef
2008 May 13
2
[LLVMdev] Python bindings available.
On 2008-05-13, at 02:12, Mahadevan R wrote:
>>> That's not how the object works...
>
> Gordon, I think I can make it work if we have the following additional
> function in LLVM-C:
>
> LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef MP) {
> return wrap(unwrap(MP)->getModule());
> }
Can I ask, how general is your solution? I only intended to use this