search for: photo

Displaying 20 results from an estimated 3452 matches for "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 Photo.update(params[:...
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/../...
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_s...
2005 Jul 22
2
Unpredictable behavoir using Sortable javascript
Hey all, I''m attempting create a photo album that can be re-ordered using the great scipts 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...
2005 Sep 19
2
warning: already initialized constant
Hello all. I''m new to Rails and working on replacing an existing Perl based 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...
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 "som...
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. <%= select("post", "album_id", Album.fin...
2008 Sep 18
2
Setting up Fleximage
Hello! I''ve been trying today to setup fleximage to handle photo uploads to a RoR application by following the tutorial that is provided (http://github.com/Squeegy/fleximage/wikis/gettingstarted) Originally, I just dropped in all of the sample code that they provided, which I copied below this question. - When I tried to access "new" to upload a new...
2006 Jun 08
1
Error Handling Question
Being somewhat new to both Ruby and Rails, I am unsure about how to initiate some kind of error handling. Currently I have a blog-like application where each post is a photograph. I am working on the "show" method for the PhotoController and need to tell the application what to do when a photo cannot be found with the specified id: class PhotoController < ApplicationController def show if params[:id].nil? #Take the user to the index page of...
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 regular old scaffolding code to save: def create @photo = Photo.new(params[:photo])...
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 (...
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'') ren...
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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are sub...
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...
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 m...
2005 Aug 17
7
(newbie) #{method}_relative_path empty (file upload 0.1.2)
...n, I''ve got two different models using it... with one of them it''s working just fine. with another, everything works, with the exception of the url_for_file_column helper, which shows /entry/file_column/ but not the relative path (/ entry_id/file_name), so it writes this: /photo/file// looks like file_relative_path isn''t returning the path, though there''s a file name written to a ''file'' column in the database table. I examined the source for the module, but couldn''t find where it breaks, if anything I''m doing is co...
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 => @photo.content_type, :file_name => @photo.filename, :disposition...