search for: container_id

Displaying 8 results from an estimated 8 matches for "container_id".

Did you mean: container_uuid
2006 Jul 07
3
dynamically updating a listbox from another listbox
Hi, I would like to be able to dynamically (without reloading the page) change the values from one listbox when a user select items from another listbox. I have a model ''Sector'' which has_many ''levels'' (and of cours, ''Level'' beyong_to ''sector''). I want to show the user two listboxes with the sectors and levels. But
2008 Mar 02
2
check_box_tag remote_function
I have a collection of check_box_tags that look like the following: <% for item in @items %> <%= check_box_tag "item[item_ids][]", item.id, false, {:onchange => remote_function(:url => update_items_path, :with => "''items='' + escape(value) "} %> <%= item.name %> <% end %> My question is, how do I send all of the current
2006 Aug 13
4
has_many and foreign_key question
Alright, noob here, etc. etc. Trying to figure out the has_many usage. If I understand correctly, when you declare that a table/class has_many whatevers, the rails assumption is that there will be a foreign key in the whatevers table pointing back to the ''id'' primary key in the first table. This doesn''t seem to be the only way to have a ''has_many''
2006 May 20
7
Polymorphic, many-to-many, self-referential data model
...alled ownerships as the join between Containers and Element. Here''s some code: create_table :containers do |t| t.column :name, :string end create_table :chunks do |t| t.column :name, :string end create_table :ownerships do |t| t.column :name, :string t.column :container_id, :integer t.column :element_id, :integer t.column :element_type, :string end Then in the models: class Chunk < ActiveRecord::Base has_many :ownerships, :as => :element end class Ownership < ActiveRecord::Base belongs_to :element, :polymorphic => true # bel...
2006 Jun 11
0
Reaching through a belongs_to for acts_as_list scope?
...9;'ve thought of two ways to solve this. 1. add main_entity_id to the Element -- this adds a redundant link in the DB, and I''d like to avoid that, but if this is the normal Rails solution, I guess I can live with it... 2. Something like acts_as_list :scope=>''container_id IN (# {container.main_entity.containers.map { |c| c.id}.join(",")})'' appears to work, but also appears a little cumbersome. Is there a better way? Eric
2007 Dec 06
0
has_many :through with a has_one source
...quot;sqlite3", :database => "has_many_through.db" ActiveRecord::Schema.define do create_table "containers", :force => true do |t| t.column :name, :string end create_table "shapes", :force => true do |t| t.column :name, :string t.column :container_id, :integer end create_table "colors", :force => true do |t| t.column :name, :string t.column :shape_id, :integer end end class Container < ActiveRecord::Base has_many :shapes has_many :colors, :through => :shapes end class Shape < ActiveRecord::Base has_o...
2009 Feb 11
0
remote_form_for file_field strangeness
Does anyone see any problem with this form? - form_remote_for(Photo.new, :html => {:multipart => true, :target => :uploader}) do |f| .form_element = f.label :photo = f.file_field :collateral = hidden_field_tag :container_id, @shoot.id = hidden_field_tag :container_type, @shoot.class.name .form_element = f.submit ''Add Photos'' The photo has a paperclip attachment called collateral, and a double polymorphic relation with container (which can be a shoot, model or photographer). At the bottom...
2006 Apr 09
4
Inheritance via Though Associations?
..., I''m still not getting exactly what I want. OK, three core tables: create_table :reference_items do |t| t.column :title, :string, :limit => 255 t.column :year, :integer, :limit => 4 t.column :type, :string t.column :container_id, :integer t.column :collection_id, :integer t.column :original_id, :integer t.column :event_id, :integer end create_table :contributors do |t| t.column :type, :string, :default => "Person" t.column :sort_name,...