Displaying 20 results from an estimated 25 matches for "image_id".
2010 Sep 08
2
subbing a string vector for another string vector
I have a data frame with two columns:
image pattern
1 http://$IMAGE_ID$ www.url.com/image.jpg
2 $IMAGE_ID$ http://www.blah.com/image.gif
...
I want to replace "$IMAGE_ID$" with the corresponding entry in the pattern
column such that the result would appear as follows:
url
http://www.url.com/image.jpg
http://www.blah.com/i...
2006 Sep 03
7
using polymorphic associations with acts_as_list
...age
end
class Child < ActiveRecord::Base
has_many :photos, :as => :image
end
I want to be able to reorder the images. What I need is for the
position of the photos to be set within the scope of the parent (ie.
either the place or child).
But when I tried it out, it is taking the "image_id" into account, but
not the "image_type". This causes a problem when a child and a place
have the same ID.
Is there a way to set the scope differently? Is it possible to set the
scope to two individual columns?
This is what I tried and failed:
acts_as_list :scope => "#...
2012 Jul 18
0
Rails 3.1 Optional Routes
Hi all,
I am using Rails 3.1 and Ruby 1.9.2
In my application i am using optional routes like below
match ''Gallery(/:gallery_id(/:image_id))(/page/:g_page)'' => "wps/
gallery#show_gallery_page",:as => :gallery_page
in console i am trying to call the routes like below
include Rails.application.routes.url_helpers
=> Object
1.9.3dev :002 > gallery_page_path
=> "/Gallery"
1.9.3dev :003 > g...
2006 Mar 20
1
FileColumn question
...ll auto_increment primary key,
image varchar(200) not null default ''''
)ENGINE=InnoDB default CHARSET=latin1;
And a car table :-
create table cars (
id integer unsigned not null auto_increment primary key,
user_id integer unsigned not null,
title varchar(100) not null,
image_id integer unsigned not null,
constraint fk_cars_user foreign key (user_id) references
users(id),
constraint fk_cars_image foreign key (image_id) references images(id)
)ENGINE=InnoDB default CHARSET=latin1;
( The user table I''m using is the one provided by the Salted Login
Generat...
2006 Aug 09
8
AJAX image manipulation
I have this code in a controller that returns images to my browser...with
ROR.
def index
@products = Product.find_all_ pictures
end
....this is the .rhtml..
<% for photo in @pic -%>
<div class="entry">
<img src="<%= photo.image_url %>"/>
<h3><%= h(photo.title) %></h3>
<%= photo.description %>
2006 Jan 14
0
Compact db design a bad idea?
...products
- id
- name
images
- id
- filename
What I can''t decide on is how to do the join tables.
Option 1 - would have many join tables and require many join models.
(The join models are to use the position field for acts_as_list to
order the images)
categories_images
- category_id
- image_id
images_products
- product_id
_ image_id
Option 2 - have a one generic join table and only one join model
image_joins
- owner_class
- owner_id
- image_id
In option 2 a record could be (Category, 2, 3) or (Product, 4, 1)
--------
Option 1 seems simpler but could lead to some repetitive code (at...
2010 May 03
7
rendering images dynamically
Hi,
I have a rails application where I respond to a request by fetching
image urls from various web api calls and need to display them as they
come available. I am able to display all the images once I get them
all, but that causes an unacceptable delay for my user.
One approach I am trying is, from my controller, set an @image
variable, and then pass in a block to the model that retrieves the
2006 May 29
4
has_many <-> belongs_to trouble
Hi all, finally im starting with rails, i have a simple relationship
has_many ans belongs_to that i dont now how to manage the update action,
here are my models
class Item < ActiveRecord::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :item
end
And my table structure:
Items => id, title, desc
Images => id, image, item_id
ok, i have a number of
2006 Jul 17
6
3 newbie questions
hey all,
I have 3 tables like this:
Images (id,name)
Tags (id,name)
ImagesTags(imageid,tagid)
in my image model I do a "has_and_belongs_to_many :tags" but to make
it work I need to rename ImagesTags(imageid,tagid) to
Images_Tags(image_id,tag_id). My question is that given that I can''t
rename the table, is there any way to make it work with the original
names?
Second question:
I have 2 tables like this:
Picture(id,name,albumid)
Albums(id,name)
in my Picture model I put:
belongs_to :album, :foreign_key => "dirid&qu...
2008 Jan 22
1
getting multiple select to work: options_for_select
Hi,
<%= select_tag ''image_id'', options_for_select(Image.find(:all) {|
an_image| [ an_image.name, an_image.id ] }), :multiple => true %></p>
* I am in a view, and I am trying to search the image table and make a
multiple select box with each image''s name.
* Right now it is working, but I see this:...
2006 Oct 23
6
nested if/else very slow, more efficient ways?
Hello,
in the data.frame "resultsfuzzy" I would like to replace the
characters in the second column ("5a", "5b", ... "5e") with numbers
from 1 to 5. The data.frame has 39150 entries. I seems to work on
samples that are << nrow(resultsfuzzy) but it takes suspicously long.
Do you have any suggestions how to make the character replacing more
2005 Mar 08
3
Extracting images from a DB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I would like to extract an image BLOB from my database and display it
alongside some other information on my ''edit'' page. I read the
information here
http://wiki.rubyonrails.com/rails/show/HowtoUploadFiles
and that was really helpful.
However, it still isn''t clear to me how I would get access to the image
in my views if
2006 Jul 18
0
another 2 newbie questions
Hey all,
Ok I have three tables:
Images(id,name,dirid) #dirid is a foreign key to Album.url, the path
to the image
Albums(id,url)
Tags(id,name)
ImagesTags(image_id,tag_id)
I have a HABTM relation for tags and images and a belongs_to/has_many
relation for albums and images.
Now in my views/tag/show.rhtml I have this:
<% for album in @albums %>
<% for image in @images %>
<% if @tag.images.include? image %> <div id="images"&g...
2006 May 16
0
strange MySQL data populating
I am getting weird data when trying to use HABTM.
I have a Images table with columns id, title, and file.
I have a Categories table with columns id, name.
I have a join table for them with image_id, and category_id
when I do @images.inspect I get:
[#"image 1", "id"=>"52", "portrait"=>"0",
"file"=>"balcony_flowers.jpg"}>, #"image 2", "id"=>"53",
"portrait"=>"...
2007 Oct 18
0
Very strange - major leak, crashed mongrel
...auses huge joins and queries down the stack.
I built a query for a subset of the reviews belonging to @submission:
@current_reviews = Review.find(:all, :conditions => cond)
The query takes 20 milliseconds. [cond is along the lines of finding
max(id) where submission_id=@submission.id group by image_id ]
Then when I try to loop thru these in view, replacing @
submission.reviews.each with @current_reviews.each , it leaks like crazy!
Same code works just fine w/ @submission.reviews.each...
The partial that it''s rendering in that loop is huge - 150 lines of code,
with all kinds of join-in...
2010 Sep 01
0
Error on update_attributes with HABTM relationship
...earch, it adds a line like this to the form markup:
<input type="hidden" name="image[provider_ids][]" value="3">
On hitting the submit button, Rails saves the Image model as expected,
and creates all the entries in my images_providers table. (consisting
of just image_id and provider_id)
The problem comes in when editing an image. On the edit page, I have
the same functionality as above available, but the existing provider
entries are already displayed on the page. So I''ll have in the form:
<input type="hidden" name="image[provider_ids]...
2006 May 11
4
modelling data to specify user access
Hello, this is my second Rails app, and the first one I did had simple
data mapping. This time I am building a site for a photographer, and
they want to upload photos, and create galleries that only certain
clients can log in and have access to. There will be multiple
galleries, and the access to them will vary depending on how the admin
assigns it to each client. There is also a porftolio
2006 Apr 22
9
one to many question
...d_belongs_to_many products
acts_as_tree :order => "name"
#...
end
class Product < ActiveRecord:Base
#...
has_and_belongs_to_many categories
#...
end
class Image < ActiveRecord:Base
#...
# ??
#...
end
Lets say the image table sql looks like this:
create table images (
image_id int not null,
entity_id int not null,
entity_type varchar(20) not null,
image_path varchar(255) not null,
image_type varchar(20) not null,
primary key(image_id)
);
For example if i were to store the "BIG", "SMALL" images for a category
in the above table, I would do:
i...
2014 Jan 17
2
Re: LVM mounting issue
-----Original Message-----
From: Richard W.M. Jones [mailto:rjones@redhat.com]
Sent: Thursday, January 16, 2014 8:58 PM
To: Исаев Виталий Анатольевич
Cc: libguestfs@redhat.com
Subject: Re: [Libguestfs] LVM mounting issue
On Thu, Jan 16, 2014 at 03:57:50PM +0000, Исаев Виталий Анатольевич wrote:
> Hello, It's me again with one more misunderstanding of libguestfs usage...
> Guestfish
2014 Jan 17
2
Re: LVM mounting issue
...uld ask you for a last thing – to check all my steps on the way to define and access the disk image. May be there is an error in my logic.
1. I want to inspect VM’s disk image. There are two disk images belonging to this VM (look at the “vm” xml file attached);
2. I determine the disk_image_id of the VM’s bootable disk (look at the image_id node in “disks” xml file attached);
3. Now I go to the RHEV-H to look for the disk image itself:
[root@rhevh1 /]# find / -name cc6e4400-7c98-4170-9075-5f5790dfcff3
/dev/1a9aa971-f81f-4ad8-932f-607034c924fc/cc6e4400-7c98-4170-9075-5f5790dfcff3...