similar to: avoiding nil object error?

Displaying 20 results from an estimated 600 matches similar to: "avoiding nil object error?"

2006 Jan 19
4
validates_presence_of
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?
2005 Dec 23
5
Can''t get data from products into @order
I went throught the "agile web developemnt with rails" and Now I''m trying to ''enhance'' the code with 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
2006 Jan 17
5
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
2006 Aug 07
4
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
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 16
2
ruby embedded code replacement for onclick in link?
Is there a ruby embedded code replacement for something like this? <a href="#" onclick="window.open(''http://192.168.78.12:3000/portfolio/show/<%= item.id %>'', ''test'', ''width=660, height=500,resizable=no'')"> <%= image_tag item.image_url, :size => ''200x150'' %></a> Thanks, Dan
2006 Feb 19
3
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
2010 Dec 06
10
testing chapter: agile web dev withrails
I am working my way through Agile web development with rails and I''m in the testing chapter. when I run the following test(or any other test) I''m new and not sure where to start looking. require ''test_helper'' class ProductTest < ActiveSupport::TestCase # Replace this with your real tests. test "the truth" do assert true end end I
2006 Apr 27
3
LoginEngine File_column interop
-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 Hello all, I hope someone can help me with this issue, I have the SVN file_column and using LoginEngine/UserEngine with 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
2006 Jan 10
3
multiple items on 1 column
Hello, I am trying to put multiple items in one column and can''t seem to get the syntax right. These are images and the image url''s are being pulled from a database. 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: <%
2006 Mar 04
2
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
2008 Mar 15
9
Spaces in Ruby on Rails and how to avoid them!
Hi, I just started learning ruby on rails and I am having hard time with white spacing! Here is the piece of code that will not work: validates_format_of :image_url, :with => %r{\.(gif|jpg|png)$}i, :message => "must be a URL for a GIF, JPG or PNG image" and here is the piece of code that will work: validates_format_of :image_url, :with => %r{\.(gif|jpg|png)$}i, :message
2005 Dec 31
2
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
2011 Sep 26
1
How to determine the efficient frontier portfolios using the Black-Litterman model?
I'm trying to find 50 portfolios on the efficient frontier using the Black-Litterman model but have not found a suitable method for doing so. I tried using the "portfoliosFrontier" function given in the package fPortfolio using the "optimalPortfolios.fPort" function on package "BLCOP" but does not provide satisfactory results -- View this message in context:
2006 Mar 02
1
newbie questions: two tables - one form
NOTE: i''ve previously posted it by mistake in test forum :) Hi! I''ve got 2 tables (and models) - one with a product and second with images of this product. How to create a single form (and controller) that will insert/edit data to the product and also add links to images table and add proper product_id? I''ve added "belongs_to :product" to image model and
2006 Jan 06
3
image replacement (new Effect.*****) problem
Here''s what I''m trying to do. I have two divs, one holds about 20 small images of products and the other holds a single large image of one of the products. I''m trying to use the jazzy "new Effect." way of changing images but I can''t seem to get it too work. My script is replacing the image and then making the element disappear. What
2008 Apr 24
7
Please help. The error occurred while evaluating nil.name
Okay so heres my code which works fine, i''ll explain the problem below. <% for num in 1..-04Gazou6+pmm/bHYDwDEOA@public.gmane.org %> <table class="products" id="table1" cellspacing="2" cellpadding="3" border="3"> <tr> <td> <table width="25%"> <tr> <tr> <td><%=
2006 Jan 27
2
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
2010 Jul 30
2
finding a function or a line while debugging?
guRus Is there a way by which I can search for a particular function or a particular line of code within the maze of all the R codes that are interlinked? Say for instance I am running a code using quantstrat package and on a particular line I get the error saying x is missing in is.array(x). I want to figure out where is.array is in all the codes that my code refers to? How do I do this? Is
2006 Dec 04
3
uninitialized constant Product
I am actually following the instructions/code snippets from "Agile Web Development with Rails" and got as far as page 73 where I did ruby script/generate controller Store index, then edited store_controller.rb to class StoreController < ApplicationController def index @products = Product.salable_items end end and product.rb to: def self.salable_items find(:all,