Error While creating an appliation

Hi

Thanks for faster reply. Iam having an question. I followed the steps in
the tutorial to create an application. In doing so everything went fine.
But when I ran this command ‘ruby script\generate scaffold recipe
recipe’ i get an error message "undefined method ‘gem’ for main:Object

Please help me in this regard.

Thanks
Janakiraman

Janakiraman Mr wrote:

Thanks for faster reply. Iam having an question. I followed the steps in
the tutorial to create an application. In doing so everything went fine.
But when I ran this command ‘ruby script\generate scaffold recipe
recipe’ i get an error message "undefined method ‘gem’ for main:Object

Please help me in this regard.

You may need to install RubyGems. If you type “gem” at the command
prompt does it find something? The downloads for RubyGems are here:

http://rubyforge.org/frs/?group_id=126


Michael W.

Michael W. wrote:

Janakiraman Mr wrote:

Thanks for faster reply. Iam having an question. I followed the steps in
the tutorial to create an application. In doing so everything went fine.
But when I ran this command ‘ruby script\generate scaffold recipe
recipe’ i get an error message "undefined method ‘gem’ for main:Object

Please help me in this regard.

You may need to install RubyGems. If you type “gem” at the command
prompt does it find something? The downloads for RubyGems are here:

http://rubyforge.org/frs/?group_id=126


Michael W.

Yes when i type gem a command window opens and closes immediately. Have
i installed gems or do i need to install it? I think i have installed
rubygems. when i click start->programs->Ruby->Ruby182-15->RubyGems. I
could find rubygems. Then what could be wrong.

Thanks
Janakiraman

Janakiraman Mr wrote:

prompt does it find something? The downloads for RubyGems are here:

Yes when i type gem a command window opens and closes immediately. Have
i installed gems or do i need to install it? I think i have installed
rubygems. when i click start->programs->Ruby->Ruby182-15->RubyGems. I
could find rubygems. Then what could be wrong.

Sounds like you’re typing the “gem” command in the “Run…” dialog. If
so, don’t do that; do “cmd” in the “Run…” dialog to get a command
window. Then type the “gem” command in that window and you should get
back errors.

By typing it in the run dialog, windows just tries to run the gem
program (opening a console to do so) and it fails, so it exits and
closes the console.

Post the errors you get and hopefully someone can help here. Apologies
if I’ve totally misunderstood.

b

Janakiraman Mr wrote:

Ben M. wrote:

Janakiraman Mr wrote:

Yes when i type gem a command window opens and closes immediately.

Sounds like you’re typing the “gem” command in the “Run…” dialog.

When I do so I get an message like this.

Ruby gems is a sophisticated package manager for ruby. This is a basic
help message containing pointers to more information.

some other help commands to follow…

Am i in the right direction?

Well, yeah… that’s what just running gem should give you… sounds
like you have rubygems installed.

Hmm, I just went back and looked at your original question: what would
cause "undefined method ‘gem’ for main:Object "? I
pondered that for few minutes and on a hunch I tried typing the “gem”
command in a Ruby irb session and that’s the exact error I get.

Now, how you managed to get that error from running “ruby
script\generate scaffold recipe” on the command line I’m not sure…

I guess my suggestions would be to make sure you are running that
command at a windows command prompt and to maybe go back to the
beginning of the tutorial you’re using and make sure you’ve done each
step exactly right.

good luck,

b

if u are getting that message then ur gems are installed correctly and
working fine i hope, try using,
gem -v it will give the version of ur gems. So i hope if u run ur
scaffold it will work,

Ben M. wrote:

Janakiraman Mr wrote:

prompt does it find something? The downloads for RubyGems are here:

Yes when i type gem a command window opens and closes immediately. Have
i installed gems or do i need to install it? I think i have installed
rubygems. when i click start->programs->Ruby->Ruby182-15->RubyGems. I
could find rubygems. Then what could be wrong.

Sounds like you’re typing the “gem” command in the “Run…” dialog. If
so, don’t do that; do “cmd” in the “Run…” dialog to get a command
window. Then type the “gem” command in that window and you should get
back errors.

By typing it in the run dialog, windows just tries to run the gem
program (opening a console to do so) and it fails, so it exits and
closes the console.

Post the errors you get and hopefully someone can help here. Apologies
if I’ve totally misunderstood.

b

When I do so I get an message like this.

Ruby gems is a sophisticated package manager for ruby. This is a basic
help message containing pointers to more information.

some other help commands to follow…

Am i in the right direction?

Thanks
Janakiraman

Janakiraman Mr wrote:

Naga harish Kanegolla wrote:

if u are getting that message then ur gems are installed correctly and
working fine i hope, try using,
gem -v it will give the version of ur gems. So i hope if u run ur
scaffold it will work,

Thanks for all your suggestions. But iam still confused and dont know
what to do.

The gem version that iam using is 0.8.10.

when i do the following I get the same error.

c:\ruby “c:\program files\apache
group\apache2\htdocs\myfirstapp\script\server”

I get the same error undefined method ‘gem’…

I think this command is to start the webrick.

Please instruct as to what to do next. Iam in trouble.

Thanks
Janakiraman

Thanks a lot for all your support and quick responses. I went through
the forum and found the right solution for this. I just update the ruby
gem and everything worked fine.

Thanks a lot!!!

Janakiraman

Naga harish Kanegolla wrote:

if u are getting that message then ur gems are installed correctly and
working fine i hope, try using,
gem -v it will give the version of ur gems. So i hope if u run ur
scaffold it will work,

Thanks for all your suggestions. But iam still confused and dont know
what to do.

The gem version that iam using is 0.8.10.

when i do the following I get the same error.

c:\ruby “c:\program files\apache
group\apache2\htdocs\myfirstapp\script\server”

I get the same error undefined method ‘gem’…

I think this command is to start the webrick.

Please instruct as to what to do next. Iam in trouble.

Thanks
Janakiraman

Also try upgrading your Ruby gems:

sudo gem update --system

http://rubygems.org/read/chapter/3

Joey

Janakiraman Mr wrote:

Janakiraman Mr wrote:

Naga harish Kanegolla wrote:

if u are getting that message then ur gems are installed correctly and
working fine i hope, try using,
gem -v it will give the version of ur gems. So i hope if u run ur
scaffold it will work,

Thanks for all your suggestions. But iam still confused and dont know
what to do.

The gem version that iam using is 0.8.10.

when i do the following I get the same error.

c:\ruby “c:\program files\apache
group\apache2\htdocs\myfirstapp\script\server”

I get the same error undefined method ‘gem’…

I think this command is to start the webrick.

Please instruct as to what to do next. Iam in trouble.

Thanks
Janakiraman

Thanks a lot for all your support and quick responses. I went through
the forum and found the right solution for this. I just update the ruby
gem and everything worked fine.

Thanks a lot!!!

Janakiraman