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

Bertan Ulusoy
Bertan Ulusoy
18,047 Points

Rails 4 - Using Existing Postgresql Database Problem

Hi, I want to use existing postgresql database with rails 4 API, but I get the wrong number of arguments (1 for 0) message.

For example, I have an organizations table and it has some data in it. I want to use instance of this table as a model.

I created Organization model like this: class Organization < ActiveRecord::Base self.table_name "organizations" self.set_primary_key :id
end

How can I solve this issue?

Thanks, Bertan

1 Answer

Bertan Ulusoy
Bertan Ulusoy
18,047 Points

I forgot to add equal sign between self.table_name and "organizations". <p> I am learning :) </p> <p> The code is now,</p> <p> self.table_name = "organizations"</p>

Thanks everyone in anyway :)