Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Foundations Ruby Standard Library Observable

Wrong number of arguments error

Getting error, it looks like it's occuring on line for "AccountObserver.new" saying the wrong number of arguments (1 for 0). Feel like I'm doing the exact same thing as Jason in the video.

Here is code:

require 'observer'

class BankAccount include Observable

def initialize(name)
    @name = name
    @transactions = []

def deposit(amount)
    notify_observers(Time.now, 'deposit', amount)

def withdraw(amount)
    notify_observers(Time.now, 'withdraw', amount)


class AccountObserver def initalize(account) @account = account @account.add_observer(self) end

def update(time, kind, amount)
    puts "[#{time} (#{kind})]: #{amount}"


account = BankAccount.new("Michael") AccountObserver.new(account)

account.deposit(100) account.withdraw(50) account.withdraw(25)