Displaying 20 results from an estimated 3453 matches for "photos".
Did you mean:
photo
2005 Dec 27
4
How do you detect if ActiveRecord ''update'' fails?
So I''m updating multiple model objects in one go with something like
this in my controller:
=> Photo.update(params[:photo].keys, params[:photo].values)
When the update fails due to validation errors, how do I detect it?
The Rails API says:
"If the save fails under validations, the unsaved object is still
returned."
So I can''t simply do this:
=> if
2006 Jun 15
2
FastCGI can''t find rubygems?
...ndings, etc). I had this all up and
running perfectly with lighttpd, but now I''m switching over to Apache and
it''s giving me this trouble. Any ideas would be appreciated!
Thanks, Ryan
[Thu Jun 15 18:52:46 2006] [warn] FastCGI: (dynamic) server
"/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi" started (pid
23792)
/Users/ryan/Workspace/rails/photos/public/../config/boot.rb:18:in `require'':
No such file to load -- rubygems (LoadError)
from /Users/ryan/Workspace/rails/photos/public/../config/boot.rb:18
from
/Users/ryan/Workspace/rails/photos/public/../c...
2006 Feb 19
2
Sortable list (scriptalicious) and updating database
...list elements. It works, but the order of the elements will not be
updated in the database. Hopefully someone could help me, or tell me
what I''m doing wrong.
Thnx!
Rgds,
Eric
Controller: album_controller.rb
class AlbumController < ApplicationController
def show_sort_album
@photos = Photo.find(:all)
end
def sort
@photos.each do |photo|
photo.position = params[''photo-list''].index(photo.id.to_s) + 1
photo.save
end
render :nothing => true
end
end
Model: photo.rb
class Photo < ActiveRecord::Base
end
Views: show_so...
2005 Jul 22
2
Unpredictable behavoir using Sortable javascript
...pts from script.aculo.us <http://script.aculo.us>. It seems to work as
expected when I pretty much copy and paste the puzzle example but when I try
and be a bit trickier (changing the movable elements to be divs containing
images) things get wierd. I''m able to "pick" the photos up but they don''t
seem to be able to figure out where they are meant to go...
The code that functions as expected:
> <div id="photos" class="album">
> <img class="photo" src="images/IMG_0098.JPG" alt="IMG_0098.JPG" />
&...
2005 Sep 19
2
warning: already initialized constant
...d app.
Everything has been smooth, and I''m beginning to get the hang of things.
I just implemented DB based photo handling, with code directly from the
Pragmatic Rails book.
Here''s a fresh server log of my app, with a logged in user (by cookie
and session) getting a list of his photos. The first 2 requests are
fine (/photos/list), then the 3rd one requests scaffold.css (probably
just a Safari caching thing?) which I don''t think is part of the issue,
but perhaps worth noting for completeness.
The fourth request is what makes me nervous, though. It generates 2
warnings:...
2006 Jun 06
8
How do I wrap a <%= link to %> around an image?
...hat I want to use
to link some dynamically-generated image paths. Specifically, I want to
link thumbnails in a gallery to the larger images.
But I''m stymied by Rails'' syntax. I can''t figure out how to do this.
I tried this:
<%= link_to(image_tag("../../images/photos/photo.photogroup/TN_
photo.photogroup photo.filenumber .jpg"), "http://www.example.com") %>
But of course, all of the variables are being translated into HTML
literally instead of coughing up their values, so that''s no good.
So I tried this:
<%= link_to "some...
2011 Aug 27
5
image override*
Hi Team,
I have create one ruby on rails application ,i have one issue for
that image upload ,the image will override the some user , so any can solve
the issues
************************
contoller
class PhotosController < ApplicationController
# GET /photos
# GET /photos.xml
def index
@photos = Photo.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @photos }
end
end
# GET /photos/1
# GET /photos/1.xml
def show
@photo =...
2006 Feb 23
7
How to set a relationship with a value from a selection list
I realize this is probably a very basic problem but I''m developing my
first rails app and running into this problem.
I''m trying to write a photoblog application. I have a photo table and an
album table. Photo has a to-one relationship to Album. Photo.album_id =>
Album.id
In my view for photo I have a selection list that''s populated with all
the available albums.
2008 Sep 18
2
Setting up Fleximage
...er for "new" but then it
returned that it could not find the table Photo.
- I created a new migration for a photo table, including only the fields
for name and author, which are also requested in the provided "new"
view.
- Now, it just returns the error "undefined method `photos_path'' for
#<ActionView::Base:0x230ee70>"
Since I''m incredibly new to fleximage, I''m not exactly sure if I''m going
in the wrong direction with my troubleshooting, if a table even needed
to be created for the photos or what my next step should be.
If a...
2006 Jun 08
1
Error Handling Question
...dy realize this isn''t working as hoped for,
so I am hoping you can fill me in on why. The Photo#find_most_recent
is a very basic method which simply returns the most recent photo
posted.
Right now if I go to http://my.web.app/photo/show/2 everything works
fine. (I have posted about 5 test photos.) If I go to
http://my.web.app/photo/show/ everything works fine, as well. The
error occurs when I go to http://my.web.app/photo/show/32432 . I get
the error message: " ActiveRecord::RecordNotFound in
Photo#show"..."Couldn''t find Photo with ID=32432 AND (publishing_time
<...
2007 Aug 06
5
Problems with array mock
Hi everyone,
I''m trying this in my helper spec and it didn''t work:
@curr_odontogram.should_receive(''photos[1]'').and_return(@photo)
and the error is:
SyntaxError in ''PersonHelper Deberia devolverme un link para eliminar una foto''
compile error
/home/gramos/src/rails/r-dental/config/../vendor/plugins/rspec/lib/spec/mocks/proxy.rb:99:
syntax error, unexpected ''['...
2006 Feb 25
1
checkbox helper question
I used scaffolding, then modified. As an after thought I added a
"boolean" checkbox to my database, form with this tag
<p>
<%= check_box ''is_hot_item'', @photo.is_hot_item %>
<label for="is_hot_item">hot item?</label><br>
</p>
I check it and save. But I don''t get 1 saved in my database field.
:(
I have just the
2010 Mar 30
2
setting up has_many
Do I have to manually set a column in a dependent table for the id of
the object to which it belongs?
I have a collection of objects called photos that are owned by a
analysis object. When I try to show an attribute of each of the photo
objects I get this error:
Mysql::Error: Unknown column ''photos.analysis_id'' in ''where clause'':
SELECT * FROM `photos` WHERE (`photos`.analysis_id = 7)
Extracted source (a...
2006 Jun 24
2
using flickr.rb
Does anyone have any experience with using flickr.rb? Seems the only
thing which is documented for it is searching through your photos.
Anyway, all I''m trying to do is return a list of my 20 most recent
photos, but nothing seems to work.
doing this returns 100 photos for a given user (which takes all day to
load)
@flickr = Flickr.new ''API KEY''
@user = @flickr.users(''USERNAME'')
rend...
2007 May 11
4
"validates_presence_of" not working
Hi, guys,
I''m learning to use Rails, and, while reading the "Rails: Up And
Running" book, I tried to make an insertion validation, using the
following code:
class Photo < ActiveRecord::Base
validates_presence_of :filename
end
It simply didn''t work, the validation does nothing and an insertion
with an empty field returns TRUE.
What''s wrong?
2006 Apr 11
2
Getting distinct years from a date column the Rails way
I have an original_at column in my photos table. I''d like to get a list
of distinct years that occur in this column, and some of the values are
NULL. I see two ways of doing this. The SQLish way:
photos = Photo.find :all, :select => ''distinct year(original_at)''
This is efficient in that it utilizes the d...
2009 Jun 11
0
Free Slideshow Maker Comparison and Brief Tutorial
...ough this article to know about how to create slideshow for free with slideshow making software. None of them would cost you a penny. Actually they probably exist in your computer system. So, just locate and run to start slideshow making, at least to kill boring time or relive beautiful memory with photos. This article will contain following parts:
Part 1: Free Slideshow Maker Comparison
Part 2: Using Free Slideshow Maker for Windows
Part 3: Using Free Slideshow Maker for Mac
Part 1: Free Slideshow Maker Comparison
Beside free slideshow maker for windows (Windows Movie Maker), free slideshow ma...
2005 Aug 17
7
(newbie) #{method}_relative_path empty (file upload 0.1.2)
...f anything I''m doing is conflicting with the module for
instance.
here''s the model
require_dependency ''rails_file_column''
class Photo < ActiveRecord::Base
belongs_to :user
file_column :file
def set_to_last_position
position = user.photos.size + 1
end
def before_create
set_to_last_position
end
end
any ideas why FileColumn wouldn''t find the file''s relative path?
thanks
oliver
2011 Oct 10
2
nested attributes question
Hi,
I have a product that has many photos, so when creating a new product
the user can upload as many photos as they want. This all works fine
using nested attributes for. I want the user to be able to set one of
the photos as the default/primary photo, so i have played around with
using a radio button to decide which photo to select as...
2008 Oct 08
11
Using image_tag and send_data
I am using image_tag to load an image that I''ve saved to the database
(using attachment_fu if you''re curious but that''s probably not
relevant here):
VIEW
<%= image_tag ''/photo/get_image/5'' %>
CONTROLLER
def get_image
@photo=Photo.find(params[:id])
send_data(DbFile.find(@photo.db_file_id).data,
:type =>