Displaying 5 results from an estimated 5 matches for "picture_id".
Did you mean:
picture_2
2006 Jan 09
1
Saving an upload
...ing NOT NULL,
has_subtitles boolean NOT NULL,
is_censored boolean NOT NULL,
episode_no integer NOT NULL,
length character varying NOT NULL,
description text NOT NULL,
release_date date NOT NULL,
file_url character varying NOT NULL,
size double precision NOT NULL,
picture_id integer NOT NULL REFERENCES pictures(id),
primary key (id)
);
CREATE TABLE films_pictures (
film_id integer NOT NULL,
picture_id integer NOT NULL,
"position" integer NOT NULL,
primary key (film_id, picture_id)
);
Here''s the Ruby:
film.rb:
class Film <...
2005 May 23
1
has_and_belongs_to_many dual insert error ?
...t;. The user edits the list, and separates the words using a
comma.
Then, my controller splits everything back, and asks the Picture domain
object to update it''s tags.
The implementation is at the bottom, but the end result is that I get
two rows like this:
INSERT INTO pictures_tags(picture_id, tag_id) VALUES (13, 21);
INSERT INTO pictures_tags(picture_id, tag_id) VALUES (13, 21);
If I add a unique index to pictures_tags, MySQL rejects the second
insert, as it should.
The only way I found to prevent that problem is to save my picture
first, and then to update the tags.
Is that behav...
2005 Dec 23
6
file_column and HABTM
I have several models that will be using file_column by way of the
"Picture" class (HABTM). Right now, all pictures are stored in:
public/picture/image/1/filename1.jpg
public/picture/image/2/filename2.jpg
Is there a way I can dynamically define the "store_dir" based on the
model? For example, if I have "user", "product" and "place" models all
2006 Jan 18
1
HABTM - Destroy just the relationship
If I have a HABTM relationship between two models (places, pictures),
can I delete the record from the join table without also destroying the
objects?
IE:
1. @places.pictures << @picture
2. @places.pictures.find( @picture.id ).destroy
I''d want line #2 (...or something similar unless I''m way off) to destroy
the record in pictures_places only, and not anything from the
2007 Jul 21
3
unable to get "has_many :after_add" to work - need help
....column :rating, :float
end
end
def self.down
drop_table :pictures
end
end
--------------------------------------------------------------------------------------
class CreateRatings < ActiveRecord::Migration
def self.up
create_table :ratings do |t|
t.column :picture_id, :integer
t.column :amount, :float
end
end
def self.down
drop_table :ratings
end
end
--------------------------------------------------------------------------------------
script/console
p = Picture.create(:title => ''p02'')
Rating.create(:a...