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 ActiveRecord Basics Query Interface Finding Scopes

rake aborted! NoMethodError: undefined method `city=' for #<Account:0x007fef60ec49e0>

oMethodError: undefined method city=' for #<Account:0x007fef60ec49e0> /Users/jitendragoyal/biller/db/seeds.rb:13:inblock in <top (required)>' /Users/jitendragoyal/biller/db/seeds.rb:9:in times' /Users/jitendragoyal/biller/db/seeds.rb:9:in<top (required)>' Tasks: TOP => db:seed

4 Answers

Hi again,

[EDIT: First, add a space between city and the equals sign - that might help. /EDIT]

OK - I just saw that this was biller; I have the code for that.

In seeds, you create a new Account instance and call is a. That's then populated with Faker data with this line:

    a = Account.new
    a.city = Faker::Address.city 

This requires the Account model to have a city property. In schema.rb this table should look like:

  create_table "accounts", force: true do |t|

    t.string   "city"

That means that Account has a city field that you can access with dot notation of the instance of Account called a in seeds.rb.

I hope that helps,

Steve.

Hi Jitendra,

This is an issue in your seeds.rb file. It doesn't recognise your use of city - can you paste in your seeds.rb code and also the model that you're trying to access the city property of?

Steve.

thanks steve for ur help.

Fixed the issue?

Hi, Steve.fixed the issue now.thanks