Mac Leopard Tutorial Issue(s)

I am a Newb using Ruby 1.8.6 and Rails 2.3.4 on a Mac OS: 10.5.8

I have run into some issues with the Customizing Rails Applications on
MAC OSX for Leopard. Hopefully this is a case of Stupid Newb tricks that
are easily resolved so here goes.

I am following the Developing and Customizing Rails
(http://developer.apple.com/Tools/developonrailsleopard.html,
http://developer.apple.com/Tools/customizeonrailsleopard.html) tutorials
and have run into 2 problems.

The first involves the “Writing Tests” section of Developing Rails. I
added the following test method to the test/unit/event_test.rb file:


require ‘test_helper’

class EventTest < ActiveSupport::TestCase
test “the truth” do
assert true
end
end

def test_budget
event = Event.new(:name => ‘Test Event’, :budget => 30.00)
event.expenses.build(:amount => 10.00)
event.expenses.build(:amount => 20.50)
assert event.save

assert_equal BigDecimal(“30.50”), event.total_expenses
assert event.budget_exceeded?
end


Then I ran test:units and instead of getting
4 tests, 6 assertions, 0 failures, 0 errors
I get
3 tests, 3 assertions, 0 failures, 0 errors.

Should that be of any concern?

This leads to my second problem. In the “View Helpers” Section of
“Customizing Rails…” tutorial I attempt to run Show on my Vendors and
receive the following message:


NoMethodError in Events#show
Showing app/views/events/_expenses.erb where line #15 raised:
Attempt to call private method
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/attribute_methods.rb:236:in
`method_missing’


What am I doing wrong?
I can provide more detail if necessary. I look forward to your response.

Best Regards!

Steve Marz wrote:

I am a Newb using Ruby 1.8.6 and Rails 2.3.4 on a Mac OS: 10.5.8

I have run into some issues with the Customizing Rails Applications on
MAC OSX for Leopard. Hopefully this is a case of Stupid Newb tricks that
are easily resolved so here goes.

I am following the Developing and Customizing Rails
(http://developer.apple.com/Tools/developonrailsleopard.html,
http://developer.apple.com/Tools/customizeonrailsleopard.html) tutorials
and have run into 2 problems.

I’m not surprised. That tutorial is for Rails 2.0.2, not 2.3.4.

The first involves the “Writing Tests” section of Developing Rails. I
added the following test method to the test/unit/event_test.rb file:


require ‘test_helper’

class EventTest < ActiveSupport::TestCase
test “the truth” do
assert true
end
end

def test_budget
event = Event.new(:name => ‘Test Event’, :budget => 30.00)
event.expenses.build(:amount => 10.00)
event.expenses.build(:amount => 20.50)
assert event.save

assert_equal BigDecimal(“30.50”), event.total_expenses
assert event.budget_exceeded?
end


Then I ran test:units and instead of getting
4 tests, 6 assertions, 0 failures, 0 errors
I get
3 tests, 3 assertions, 0 failures, 0 errors.

Should that be of any concern?

I don’t know. I use RSpec for all my testing, since Test::Unit kinda
sucks IMHO.

This leads to my second problem. In the “View Helpers” Section of
“Customizing Rails…” tutorial I attempt to run Show on my Vendors and
receive the following message:


NoMethodError in Events#show
Showing app/views/events/_expenses.erb where line #15 raised:
Attempt to call private method
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/attribute_methods.rb:236:in
`method_missing’


What am I doing wrong?

What’s on that line?

Anyway, what you’re doing wrong is using an old tutorial. Check out
http://guides.rails.info .

I can provide more detail if necessary. I look forward to your response.

Best Regards!

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]