Run query on IRB

Hi All
I never worked with RUBY my fisrt time.

I’d like to run this query by IRB and see how many line it will show
me :

select codigo, nome from teste

My database is postgre 8.4

Look what i did to do it:

irb(main):006:0> Post.find_by_sql “SELECT codigo, tirulo from teste”
NameError: uninitialized constant Post
from (irb):6
irb(main):007:0>

What is going on there?

Thanks

Grato

Yes and it created tha database.yml

development:
adapter: postgresql
encoding: unicode
database: postgres_development
pool: 5
username: postgres
password: 031969

test:
adapter: postgresql
encoding: unicode
database: rubyPostgre_test
pool: 5
username: rubyPostgre
password:

production:
adapter: postgresql
encoding: unicode
database: rubyPostgre_production
pool: 5
username: rubyPostgre
password:

And my query it to be runing on development enviroment.
Can u help me run my query?

Thanks

2010/5/4 Dhruva S. [email protected]

Have you created a rails application ?
What in your opinion is Post? Ruby expects to find a constant by that
name.
class names in Ruby are constants. constant is any word that starts with
a
capital letter.

If say you’ve written a class Post, then you must have done so in a
file.
You need to require that file when inside irb to load that class.

On Tue, May 4, 2010 at 17:08, jv neto [email protected] wrote:

Look what i did to do it:

http://groups.google.com/group/rubyonrails-talk?hl=en.

Thanks & Regards,
Dhruva S…

Hi, if it’s rails.
You should go to your applications root & type ‘ruby script/console’ ,
if
your on a mac you could just type ‘script/console’.

When the console starts, you will be able to do what you were trying to
do
in your IRB.

On Tue, May 4, 2010 at 22:30, jv neto [email protected] wrote:

test:
database: rubyPostgre_production

On Tue, May 4, 2010 at 17:08, jv neto [email protected] wrote:

Thanks
For more options, visit this group at


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Thanks & Regards,
Dhruva S…