Displaying 9 results from an estimated 9 matches for "photo_id".
Did you mean:
photo_ids
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi
I noticed that if in my code I use the following:
Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})")
All my objects are properly updated but none of the filters/callbacks
are triggered. Is that what''s expected?
I have a before_update filter set on the Photo class and it gets
totally ignored, I guess the only way to solve this issue is to
enumerate through the objects and updat...
2006 Jul 21
1
What''s wrong with this code?
...= Net::HTTP::Get.new(path)
response = http.request(request)
response.value
response.body
end
path =
"/services/rest/?api_key=API_KEY&method=flickr.photos.search&user_id=USER_ID&tags=TAG"
http = Net::HTTP.new(''flickr.com'')
@photo_ids = Array.new
http.start do |http|
xml = get_response(path, http)
REXML::Document.new(xml).root.get_elements(''photo'').each do
|photo|
id = photo.attributes[''id'']
@photo_ids << id
end
end
#Application.rhtml layout...
2009 Feb 21
1
undefined method user_id
...ts_controller.rb:8:in `create''
This is my comments controller:
class CommentsController < ApplicationController
before_filter :login_required
def create
@photo = Photo.find_by_user_id_and_id(params[:user_id],
params[:photo_id])
@comment = Comment.new(:user_id => @logged_in_user.id,
:body =>
params[:comment][:body])
if @photo.comments << @comment
flash[:notice] = ''Comment was successfully created.''
redirect_to photos_path(:user...
2009 Feb 22
2
Mysql error unknown column 'columns.user_id'
...photos.`id` AS t0_r0, photos.`user_id` AS t0_r1, photos.`title` AS
t0_r2, photos.`body` AS t0_r3, photos.`created_at` AS t0....
I did create a user_id column in the comments as such:
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.column :photo_id, :integer
t.column :user_id, :integer
t.column :guest_name, :string
t.column :guest_email, :string
t.column :guest_url, :string
t.column :body, :text
t.column :created_at, :datetime
end
add_index :comments, :photo_id
end
def self.down
drop_table...
2006 Apr 09
1
RJS across iframes
I have an inline iframe which has a form in it, when the form is
updated, I would like to call an RJS template that will update the
parent page.
+-----------------------------------------------+
| |
| <div id="mydiv"> Update with RJS </div> |
| |
|
2008 Mar 15
1
error on belongs_to method.
I followed the Ruby on Rails up and running book published by Orielly.
there are three DB tables, photo, slideshow, and slide
the Slide class in slide.rb is like this:
class Slide < ActiveRecord::Base
belongs_to :photo :foreign_key =>photo_id
belongs_to :slideshow :foreign_key=>slideshow_id
end
I inserted the sample data into database. When I trying to run the
command on page39:
slide= Slide.find 1
it give me the following error:
../slide.rb:2: syntax error, unexpected '';'', expecting kEND.
and the same with ../sli...
2011 Jun 27
1
import text-records and set the fields in a table
hi!
I apologize in advance if this is a newbie dumm question, but I really can't
figure it ou.
I have lists of sumeric and character data on some URLs, which look like
this:
<photo id="5876248819" owner="13716719 at N04" secret="faf9bb7f52"
server="5264" farm="6" title="our rose garden" ispublic="1"
2006 Aug 12
7
Collection assignment to a has_many :through
...s, many-to-many association. It worked well
with HABTM. Then I decided that it would be good to be able to change
order of the photos so that thumbnail pages would look less chaotic.
So I created a Layout model which is a join model (or whatever it is
called) that replaces HABTM relation. It has photo_id, category_id and
position. Photo has many layouts and many categories through layouts.
Category is analogous.
In this way I obtained a structure that works as the one before with one
exception: there is no Photo.categories= method when :through is used.
After hours of googling (no-one gives ex...
2006 May 01
0
Having trouble adding rows to an association
...e
has_many :endroits_photos,
:dependent => true,
:foreign_key => "endroit_connu_id"
has_many :photos,
:through => :endroits_photos,
:foreign_key => "endroit_connu_id"
end
this is the code used :
key = params[:post][:photo_id]
@photo =
EndroitsConnu.find(params[:endroit]).endroits_photos.create(:photo =>
Photo.find(key))
the main problem is that rails searchs a sequence for the joind table
and such a sequence doesn''t exist !!
if the someone catch the problem , it would be great !!
thanks
--
Poste...