Jun 17, 2008
Generic-user-small Charles Harvey 5 posts

Topic: Everyday Active Record / Requests for your upcoming Validations Screencast

Hi Ryan-

Your first two screencasts with the Pragmatic Programmers are great.
I am looking forward to your upcoming screencast on validations.
I also enjoyed your railscast #41 and #62 on validations.

I am hoping you may include some information on a few areas that I don’t quite understand fully.

How does this work and in what context should I use it.
validates_presence_of(:address, :if => Proc.new {|a| a.create_step == 8})

In what cases and how do I use with_options for validations.
The Rails Way book mentions this on page 493, but a more in depth coverage would be useful.

An update to your episode 41 on Conditional Validations would be quite useful as well. Is this still the best way to do this in Rails 2.1?

If you ever need a reviewer you have a volunteer here.

Best Regards-

Charles

 
Jun 16, 2008
Generic-user-small Charles Harvey 5 posts

Topic: Advanced Rails Recipes / Recipe 20 strftime nil errors

Hi Mike-

Thanks for a great book. I have been using the beta book for a fewmonths and am happy to have my hard copy now.

Is there a way to eliminate nil errors in a dry way?

You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.strftime

I know I can do something like
<%= order.placed_at.to_s(:chatty) unless order.nil? %>

to eliminate the problem in the date_time_format.rb or somewhere else so it is dry.
Any ideas?

Best Regards-

Charles

 
Mar 22, 2008
Generic-user-small Charles Harvey 5 posts

Topic: Advanced Rails Recipes / problems with Encrypt Sensitive Data and rails 2.0.2? Errno::ENOENT: No such file or directory - /Users/jane/Development/actsassecure/config/crypto.yml

Hi Mike-

Thanks. I could not find the details of the crypto.yml file in the recipe. Your update here is a great help.

Best Regards-

Charles

 
Mar 19, 2008
Generic-user-small Charles Harvey 5 posts

Topic: Advanced Rails Recipes / problems with Encrypt Sensitive Data and rails 2.0.2? Errno::ENOENT: No such file or directory - /Users/jane/Development/actsassecure/config/crypto.yml

When going through the tutorial I get

Loading development environment (Rails 2.0.2)
>> SecretPatient.create(:name => ‘John Doe’, :address => ‘Somewhere Secret’, :ssn => ‘012-345-6789’)
Errno::ENOENT: No such file or directory – /Users/jane/Development/actsassecure/config/crypto.yml

then I created a blank file called config/crypto.yml and try again and I get

from (irb):1>> SecretPatient.create(:name => 'John Doe', :address => 'Somewhere Secret', :ssn => '012-345-6789')  
NoMethodError: undefined method `[]' for false:FalseClass from /Users/jane/Development/actsassecure/lib/master_crypto_provider.rb:13

I have the latest acts_as_secure
rel_0_0_3:
date: 2007-06-26

and
ezcrypto (0.7)

Best Regards-

Charles

See the pastie for a nice view

http://pastie.caboo.se/167623

jane-harveys-computer:~/Development/actsassecure jane$ script/console
Loading development environment (Rails 2.0.2)
>> SecretPatient.create(:name => ‘John Doe’, :address => ‘Somewhere Secret’, :ssn => ‘012-345-6789’)
Errno::ENOENT: No such file or directory – /Users/jane/Development/actsassecure/config/crypto.yml from /usr/local/lib/ruby/1.8/yaml.rb:143:in `initialize’ from /usr/local/lib/ruby/1.8/yaml.rb:143:in `open’ from /usr/local/lib/ruby/1.8/yaml.rb:143:in `load_file’ from /Users/jane/Development/actsassecure/lib/master_crypto_provider.rb:13 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_file’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in `load_file’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in `require_or_load’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in `const_missing’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:260:in `load_missing_constant’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:469:in `const_missing’ from /Users/jane/Development/actsassecure/app/models/secret_patient.rb:10 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_file’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in `load_file’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in `require_or_load’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in `const_missing’

  1. So I created a blank config/crypto.yml file and tried again
from (irb):1>> SecretPatient.create(:name => 'John Doe', :address => 'Somewhere Secret', :ssn => '012-345-6789')  
NoMethodError: undefined method `[]' for false:FalseClass from /Users/jane/Development/actsassecure/lib/master_crypto_provider.rb:13 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_file' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in `load_file' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in `require_or_load' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in `const_missing' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:471:in `send' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:471:in `const_missing' from /Users/jane/Development/actsassecure/app/models/secret_patient.rb:10 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_file' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in `load_file' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in `require_or_load' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in `const_missing' from (irb):2>>
 
Feb 4, 2008
Generic-user-small Charles Harvey 5 posts

Topic: Deploying Rails Applications / Nginx

What you have so far on Nginx is great, more info would be even better, for example a
a Trac install, with subversion. While TRAC is not ruby it is essential to the deployment and installation of ruby, if users are going to leave apache for their rails apps they need all the common development tools which includes Trac, with subversion.

5 posts