Need help with Rails and webrick

View: New views
6 Messages — Rating Filter:   Alert me  

Need help with Rails and webrick

by davelpat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I’m starting to work through the book Agile Web Development with Rails, 3rd Edition using Netbeans 6.7.1 as my IDE.  I know a little Ruby, no Rails, and have just started using Netbeans.  Using the first example in that book, I have created these files:



E:\MyNbWorkspace\Demo\app\controllers\say_controller.rb




Code:
class SayController < ApplicationController

  def hello

  end

end





E:\MyNbWorkspace\Demo\app\views\say\hello.html.erb:




Code:
<html>

  <head>

    <title>Hello, Rails!</title>

  </head>

  <body>

    <h1>Hello from Rails!</h1>

  </body>

</html>







as specified in the book through page 50.  Can't get much simpler to just verify a good installation.

Webrick comes up at http://localhost:3000/ when I run the Demo project in Netbeans, but I get a 500 error when I go to http://localhost:3000/say or to http://localhost:3000/say/hello.



Here's the WEBrick output:




Code:
=> Booting WEBrick

=> Rails 2.3.2 application starting on http://0.0.0.0:3001

JRuby limited openssl loaded. gem install jruby-openssl for full support.

http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL

C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:84 warning: given block not used

=> Call with -d to detach

=> Ctrl-C to shutdown server

[2009-09-08 15:29:11] INFO  WEBrick 1.3.1

[2009-09-08 15:29:11] INFO  ruby 1.8.6 (2009-07-23) [java]

[2009-09-08 15:29:11] INFO  WEBrick::HTTPServer#start: pid=1836 port=3001





I’m using:

Rails 2.3.2

JRuby 1.8.6

Java jdk1.6.0_07

MySQL 5.1 (not using yet for this)

Netbeans 6.7.1

Firefox 3.5.2

XP SP3



I've also attached the IDE log.



Any ideas would be greatly appreciated.



Thanks,

Dave[/code]




Attachments:
http://forums.netbeans.org//files/ide_log_200909081514_104.txt



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Need help with Rails and webrick

by Hassan Schroeder-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Sep 8, 2009 at 4:10 PM, davelpat<davelpat@...> wrote:

> Here's the WEBrick output:

> [2009-09-08 15:29:11] INFO  WEBrick 1.3.1
> [2009-09-08 15:29:11] INFO  ruby 1.8.6 (2009-07-23) [java]
> [2009-09-08 15:29:11] INFO  WEBrick::HTTPServer#start: pid=1836 port=3001

That's just startup stuff; if you had an error in development mode,
you should have more in the logs reflecting that.

> JRuby 1.8.6

Well, no, actually you're using JRuby 1.2.0; I doubt it's your problem,
but you might want to upgrade to 1.3.1 (latest stable).

--
Hassan Schroeder ------------------------ hassan.schroeder@...
twitter: @hassan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Need help with Rails and webrick

by davelpat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks, Hassan, but this doesn't help me -- not sure what you are pointing out.  WEBrick comes up fine, but doesn't render the "hello" view when I give it the action path say/hello.  Any idea why?






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Need help with Rails and webrick

by Hassan Schroeder-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Sep 8, 2009 at 5:11 PM, davelpat<davelpat@...> wrote:
>
> WEBrick comes up fine, but doesn't render the "hello" view when I give it the action path say/hello.  Any idea why?

If your app is generating a 500 error, there should be something in
the log -- are you saying there's nothing else?

And are you sure you're running in development mode? You should
really see the error in the browser.

--
Hassan Schroeder ------------------------ hassan.schroeder@...
twitter: @hassan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Need help with Rails and webrick

by Chris Kutler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Welcome to the fast changing pace of Rails.

When you start up the WEBrick server, note that it says

=> Rails 2.3.2 application starting on http://0.0.0.0:3001


If you look in the first page of the book (Important Information about
Rails Versions) you will see that the book was tested against Rails 2.2.2.

Whenever you use an older book or tutorial against a new Rails release,
you can expect problems like this. It is best to use the Rails version
for which the book or tutorial was written.

I have a solution for you that should get you further along in the book.
However, eventually you will either have to learn about the Rails
changes subsequent to 2.2.2 so that you can modify your code to match,
or you will have to install Rails 2.2.2 (jruby -S gem install -v=2.2.2
rails) and make sure that your apps use that version (see
http://stackoverflow.com/questions/379141/specifying-rails-version-to-use-when-creating-a-new-application)

Anyway, the problem is happening because you are not using a database.
At some point after 2.2.2, you now have to change a setting if you are
not using a database.

Open config/environment.rb and unremark the following line:

config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

Restart the server. It should now work. If it doesn't let me know what
happens.

Hope this helps
Chris
http://blogs.sun.com/divas/


davelpat wrote:

> I’m starting to work through the book Agile Web Development with Rails, 3rd Edition using Netbeans 6.7.1 as my IDE.  I know a little Ruby, no Rails, and have just started using Netbeans.  Using the first example in that book, I have created these files:
>
>
>
> E:\MyNbWorkspace\Demo\app\controllers\say_controller.rb
>
>
>
>
> Code:
> class SayController < ApplicationController
>
>   def hello
>
>   end
>
> end
>
>
>
>
>
> E:\MyNbWorkspace\Demo\app\views\say\hello.html.erb:
>
>
>
>
> Code:
> <html>
>
>   <head>
>
>     <title>Hello, Rails!</title>
>
>   </head>
>
>   <body>
>
>     <h1>Hello from Rails!</h1>
>
>   </body>
>
> </html>
>
>
>
>
>
>
>
> as specified in the book through page 50.  Can't get much simpler to just verify a good installation.
>
> Webrick comes up at http://localhost:3000/ when I run the Demo project in Netbeans, but I get a 500 error when I go to http://localhost:3000/say or to http://localhost:3000/say/hello.
>
>
>
> Here's the WEBrick output:
>
>
>
>
> Code:
> => Booting WEBrick
>
> => Rails 2.3.2 application starting on http://0.0.0.0:3001
>
> JRuby limited openssl loaded. gem install jruby-openssl for full support.
>
> http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
>
> C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:84 warning: given block not used
>
> => Call with -d to detach
>
> => Ctrl-C to shutdown server
>
> [2009-09-08 15:29:11] INFO  WEBrick 1.3.1
>
> [2009-09-08 15:29:11] INFO  ruby 1.8.6 (2009-07-23) [java]
>
> [2009-09-08 15:29:11] INFO  WEBrick::HTTPServer#start: pid=1836 port=3001
>
>
>
>
>
> I’m using:
>
> Rails 2.3.2
>
> JRuby 1.8.6
>
> Java jdk1.6.0_07
>
> MySQL 5.1 (not using yet for this)
>
> Netbeans 6.7.1
>
> Firefox 3.5.2
>
> XP SP3
>
>
>
> I've also attached the IDE log.
>
>
>
> Any ideas would be greatly appreciated.
>
>
>
> Thanks,
>
> Dave[/code]
>
>
>
>
> Attachments:
> http://forums.netbeans.org//files/ide_log_200909081514_104.txt
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>  

--
Chris Kutler
Sun Cloud Learning Services


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Need help with Rails and webrick

by davelpat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Chris Kutler wrote:
>

> ...

> Anyway, the problem is happening because you are not using a database. At some point after 2.2.2, you now have to change a setting if you are  not using a database.

>

> Open config/environment.rb and unremark the following line:

>

> config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

>

> Restart the server. It should now work. If it doesn't let me know what happens.

> ...

>

> Hope this helps

> Chris

> http://blogs.sun.com/divas/




Yes!  It worked!  Thanks so much, Chris.  I really appreciate it -- and I'm sure not using a database won't last long, I'm sure.  :-)






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...