Displaying 4 results from an estimated 4 matches for "widget_id".
2005 Oct 14
1
join tables and position (acts_as_list)
...gets ordering
name text,
description text,
etc.
etc...);
CREATE TABLE attributes (
id serial,
"position" int, -- for all attributes ordering
name text,
description text,
etc.
etc...);
CREATE TABLE attributes_widgets (
"position" int, -- for attributes per given widget ordering
widget_id int references widgets (id),
attribute_id int references attributes (id),
etc.
etc...
);
Phil
2010 Feb 11
3
Parameterized ActiveRecord Associations: Any such thing?
...get_instance
widget.versioned_sprockets(version).all(:conditions =>
callers_conditions)
end
I first considered just putting a named scope directly in the Sprocket
class, giving me parameterized scoping. However, I specifically want
to access my sprockets through a Widget, getting the implicit
widget_id scoping that comes with the association. If worse comes to
worse, I''ll have an uglier named scope taking two parameters (does
this work) instead of one:
class Sprocket ...
named_scope :versioned, lambda do |widget, version|
:conditions => { :widget => widget, :version => ve...
2006 Feb 14
0
Help with Eager Association
...widgets.rb -
has_many :widget_configurations
So in otherwords, widget_configuration is a sort of ''rich'' m-to-m
association table containing foreign keys to both profiles and
widgets. The table looks like this:
widget_configurations
------------------------------
profile_id (FK)
widget_id (FK)
--------------------------
So now what I''m trying to do is this:
(assuming @profile is an instance variable w/ a profile)
@profile.widget_configurations.find :all, :include => [:widget]
I end up getting this error:
You have a nil object when you didn''t expect it!
You mig...
2006 May 19
4
Lookup tables and scaffolding
It occurs to me as a missing feature that there''s no way to indicate a lookup
table relationship (as opposed to other sorts of foreign key relationships)
in Rails and that the scaffolding generator could recognise this lookup and
render a drop-down list automagically for the lookup table.
Say you have an Address and a State, and the State is a lookup table. In
addresses you have