Hey,

Vince /. wrote:
> Hi everyone,
>
> Can anyone tell me why this doesnt work?
>
> *snip*
>
>   
Sure, where you've got a method "price=(amount)", below:
> 	def price=(amount)
> 		@price = amount
> 	end
>   
this only handles the assigning of the price variable. This means that:
> ticket.price = (5.00)
>   
works fine, but trying to access ticket.price results in the error 
you're seeing (hence why the error doesn't occur on the above line, but 
on a later line). You simply need a method declaration for retrieving 
the variable value within your class, so try putting this in there:

def price
    @price
end

This then ensures you've got one method ("price=") that handles the 
assignation of values, and one method ("price") to retrieve the current 
value.

Your following code should then work:
> puts "ticket mooch is #{ticket.price}"
>
>   
Hope that helps!

Cheers,
-= El =-

blog: http://www.crazycool.co.uk