search for: image_url

Displaying 20 results from an estimated 79 matches for "image_url".

2006 Jan 19
I am just going through the book and I come across a problem with the code in the app/models: validates_format_of :image_url, :with => %r{^http:.+\.(gif|jpg|png)$}i, :message => "must be a URL for a GIF, JPG, or PNG image" It seems to moan when it''s empty even though I removed :image_url from validates_presence_of. How should I make it optional? Altering the regex? Btw I have th...
2005 Dec 23
Can''t get data from products into @order
...ith some extra options. When I go to admin/shipping I want to include some data from the products table in with the order info listed. I can''t seem to get this to work. in my partial form I''m trying to add this: <td class="olnamebox"> <%= order_line.image_url %> </td> I''m recieving this error undefined method `image_url'' for #<Order:0xb77ee194> I call the partial with: <table cellpadding="5" cellspacing="0"> <%= render(:partial => "order_line", :collection => @pending_or...
2006 Jan 17
file_column mangling URL
Hey, I''ve gotten file_column to upload a file, drop it in the dynamic directory, but I can''t display the image, the directories repeat themselves: My model: class Person < ActiveRecord::Base file_column :image_url In my view: <%= image_tag url_for_file_column(''person'', ''image_url'') %> HTML generated is this: <img alt="Male_face" src="/dhcp/public/dhcp/public/person/image_url/3/male_face.jpg" /> There...
2006 Aug 07
Unit testing diffculty
ok, let me show you my "products" fixtures file: ram: id: 1 title: RAM description: ECC RAM Registered, 512MB image_url: images/test.jpg price: 29.95 date_available: 2005-01-25 00:00:00 busted_arsehole: id: 2 title: Busted Arsehole description: I have an arsehole, it is-e busted image_url: images/test.jpg price: 999.95 date_available: 2005-01-25 00:00:00 hey: id:...
2006 Aug 09
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 %> </div> <% end %> ....can someonw show me how I can return the results to AJAX? What I want to do is to display thumbnails along the bottom and when a user clicks on...
2006 Mar 03
avoiding nil object error? portfolios: @active_portfolios = Portfolio.find_all_by_is_active("1") In the view i render the list of portfolios: <%= render :partial => "portfolio_list", :collection => @active_portfolios %> in the partial collection _portfolio_list i need to get the image_url of the first image of the portfolio: <td class="col1"><img src="<%= portfolio_list.images[0].image_url -% >" /></td> This works fine if every portfolio has at least one image assigned to it. However, if a portfolio doesn''t have any...
2006 Feb 19
Rails urls & the AWD book
Greetings! I''m having a hard time understanding the way Rails handles urls. I''m specifically having real trouble with the image_urls in the Depot app in the Agile Web Development book. If I enter "\image\file.png" in the Add Product page, the image is displayed in the other views and Properties shows http://localhost:3000/images/file.png If I leave off the leading backslash and enter "image\fil...
2006 Jan 08
link_to_remote(image_url url_for_file_column(product, "image
I apologise for bad formatting. I don''t know how to make it nice in an email How do you nest image_url tags into link_to_remote tags. The following creates the error:wrong number of arguments (3 for 2) <%= link_to_remote(image_tag url_for_file_column(product, "image_url"), { "class" => "small_product", "onM...
2006 Jan 10
multiple items on 1 column
...base. It seems that <tr></tr> is the trigger to go onto the next item. Here is the code from the controller: def list @items = Item.find_all end Here is the code from list.rhtml file: <% @items.each do |item| %> <tr> <td> <%= image_tag item.image_url, %> </td> </tr> <% end %> I have also tried: <% for item in @items %> <tr> <td> <%= image_tag item.image_url, %> </td> </tr> <% end %> If I put multiple columns in the same row, <% for it...
2006 Apr 27
LoginEngine File_column interop
...Rails 1.1.2. My issue is that I''m overloading the view for LoginEngine to support a file image upload as part of the user record and having a heck of a time doing so. Near the bottom of my new _edit.rhtml file I put in: <tr><td><%= file_field("user", "image_url") %></td></tr> which now displays the upload field as it should when I go to sign up a user. I placed in the actual LoginEngine user.rb model the "file_column :image_url" line just below " include LoginEngine::AuthenticatedUser" and I can se...
2006 Mar 05
How to clean up this code?
...ave uploaded_image_number = 0 # number of the uploaded file save_image_number = 0 # number of the file that will be saved on the disk # for every image params[:images].length.times do # check if it was sent if(params[:images][uploaded_image_number.to_s][:image_url].size != 0) # don''t know yet how to get file extension :) ext = ''jpg'' # create new filename image_filename = "#{}-#{save_image_number.to_s}.#{ext}" # add new name to the database @product.i...
2010 Dec 06
testing chapter: agile web dev withrails
...t looking. require ''test_helper'' class ProductTest < ActiveSupport::TestCase # Replace this with your real tests. test "the truth" do assert true end end I always get ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has no column named image_url: INSERT INTO "users" ("created_at", "image_url", "title", "updated_at", "id", "description") VALUES (''2010-12-06 16:04:02'', ''MyString'', ''MyString'', ''2010-12-06 16:04:...
2006 Mar 04
unittest, not loading yml data
Here is my products.yml version_control_book: id: 1 title: Pragmatic Version Control description: How to use version control image_url: /images/sk_svn_small.jpg price: 29.95 date_available: 2005-01-26 00:00:00 automation_book: id: 2 title: Pragmatic Project Automation description: How to automate your project image_url: /images/sk_auto_small.jpg price:...
2005 Dec 31
Test Unit Problem
Hello All, I am experiencing the following test unit error working with Rails that I can''t fathom. I have a products.yml file which holds the following test fixture for the products table: dell_pc: id: 1 title: Dell PC description: Dell PC image_url: http://.../pc_image.jpg price: 15000.00 date_available: 2005-12-31 06:53:00 I also have the following product_test.rb file to test the fixture above: require File.dirname(__FILE__) + ''/../test_helper'' class ProductTest < Test::Unit::TestCase fixture...
2006 Jan 27
Grouping results
I have a general question about using a Ferret/Lucene index for grouping results. I am not sure how much of the heavy lifting the index can do for me, so I would appreciate any input. I am using ferret to index some objects that have the following properties: url, image_url, price, tags (space separated tags), created_at I would like search the index for any documents that match a specific tag. The way these results will be processed is as follows: Each URL must be unique in the results. If there are duplicates, I would like to merge the results using some fuzzy m...
2006 Sep 30
possible bug: edge rails, nested resources and images
...inally found what appears to be the source of the problem. When i have the products resource nested in categories as showen below in the first routes file i can see the categories index (/categories). When i add the images to the products resource map as shown in routes 2 i get the error: image_url failed to generate from {:controller=>"images", :action=>"show", :category_id=>"rails"} It appears that the image_tag is being confused for an image_url ??? Has anyone come across this or have the acts_as_attachment plugin working in their application....
2006 Apr 02
One to Many Relationship Issues
Hi, I am having issues with a one to many relationship(it never works :-)). Jokes aside, I am getting an error: Mysql::Error: #23000Cannot add or update a child row: a foreign key constraint fails: INSERT INTO adverts (`image_url`, `price`, `title`, `website_url`, `description`, `user_id`) VALUES(''bb'', 22.0, ''aa'', '''', ''bb'', 0) The user_id(last column) needs to be 1, and its 0 Session dump: --- flash: !ruby/hash:ActionCo...
2013 Mar 14
Error: did not find expected key while parsing a block mapping
...Test < ActiveSupport::TestCase test "product attributes not be empty" do product = assert product.invalid? assert product.errors[:title].any? assert product.errors[:description].any? assert product.errors[:price].any? assert product.errors[:image_url].any? end test "price musst be positive" do product = title: "mybook", description: "yyy", image_url: "img.jpg") product.price = -1 assert product.invalid? assert_equal "musst be greater than or equal...
2006 Jan 06
image replacement (new Effect.*****) problem
...''t cover this much. Currently I''m also only replacing the large image with the current small image (this.src). I can''t figure out how to link the large image inside of the samll image tag. Thanks again for any help! <%= image_tag url_for_file_column(product, "image_url"), { "class" => "small_product", "onMouseOver" => "this.className = ''product_hover''", "onMouseOut" => "this.className = ''small_product''", "onClick"...
2008 Apr 24
Please help. The error occurred while evaluating
...3"> <tr> <td> <table width="25%"> <tr> <tr> <td><%= @results[1].name%> | <%= number_to_currency(@results[1].price)%></td> </tr> <tr> <td><%= link_to image_tag(@results[1].image_url, :size => ''100x100'', :border => "0")%></td> </tr> <tr> <td><%= h(truncate(@results[1].description, 150))%></td> </tr> </tr> </table> <td> </table> &l...