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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <j.vieirasilva-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Thanks & Regards, Dhruva Sagar. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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 <j.vieirasilva-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> 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 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > > > -- > > Thanks & Regards, > Dhruva Sagar. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <j.vieirasilva-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> 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 <j.vieirasilva-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> 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 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Ruby on Rails: Talk" group. >>> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >>> >> >> >> -- >> >> Thanks & Regards, >> Dhruva Sagar. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- Thanks & Regards, Dhruva Sagar. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.