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 Objects and Classes Build a Bank Account Class Create a BankAccount Class

PoJung Chen
PoJung Chen
5,856 Points

I am no sure where the code error in Ruby - Object and Classes challenge

I enter the code below:

create a BankAccount class

class BankAccount def initialize(name, transactions) @name = name @transactions = Array.new end end

I continue getting the error message showing that "It looks like Task 2 is no longer exists". However, after I go back to Task 2, I pass the task with the same code. Any idea for the problems?

bank_account.rb
# create a BankAccount class
class BankAccount
  def initialize(name, transactions)
    @name = name
    @transactions = Array.new
  end
end

2 Answers

Correct code below

class BankAccount
  def initialize(name)
    @name = name
    @transactions = Array.new
  end
end
PoJung Chen
PoJung Chen
5,856 Points

I find what the error from. I need to remove the arguments "transactions" in parentheses.