I’ve created a simple hello world app that doesnt appear to serve up
the view greeting.rhtml. :<
Any ideas ?
The error message is from development.log is…
Logfile created on Tue Aug 18 16:49:55 -0400 2009/!\ FAILSAFE /!\
Tue Aug 18 16:50:34 -0400 2009
Status: 500 Internal Server Error
unknown error
PS . It does show the default web page ok at http://localhost:3000
just not the app
Here is my controller in c:\ruby\hello\app\controllers
\app_controller.rb
…
class AppController < ApplicationController
def greeting
end
end
Here is my view in c:\ruby\hello\app\views\app\greeting.rhtml
Ruby on Rails
Yes its working!
Here is the URL that I’m trying to access it
http://localhost:3000/App/greeting
PS . It does show the default web page ok athttp://localhost:3000
just not the app
It doesn’t show the app because you don’t actually have one.
You should read what you see at http://localhost:3000. Specifically,
steps 1, 2, and 3 in the main panel give you some obvious tips on
what’s next.
If these tips are too vague you can find more detailed information on
the right panel. Under “Browse the Documentation” follow “Rails
Guides” to “Getting Started with Rails”.
You might also consider picking up a book and working through an
example. Pay careful attention here, however, to the versions of Ruby
and Rails (and any gems and plugins) used in the book.
Happy tRails
I followed step by step the instructions for the first application in
the Begining Ruby for Rails book
and checked the online documentation before even posting.
Do you have any suggestions as shown I have a controller and a view
and an application defined but
its not finding it or giving me the error message posted…any
ideas ?
Thanks!
On Aug 19, 1:44 pm, mgpowers [email protected] wrote:
I followed step by step the instructions for the first application in
the Begining Ruby for Rails book
and checked the online documentation before even posting.
Do you have any suggestions as shown I have a controller and a view
and an application defined but
its not finding it or giving me the error message posted…any
ideas ?
Look at the log file in log/development.log It’s probably something
like a bad database setup or similar.
fred
I did look at the log file and even posted the error message in the
very first post…
see…below…Any ideas ?
The error message is from development.log is…
Logfile created on Tue Aug 18 16:49:55 -0400 2009/!\ FAILSAFE /!\
Tue Aug 18 16:50:34 -0400 2009
Status: 500 Internal Server Error
unknown error
Status: 500 Internal Server Error
unknown error
PS . It does show the default web page ok at http://localhost:3000
just not the app
Here is my controller in c:\ruby\hello\app\controllers
\app_controller.rb
…
class AppController < ApplicationController
def greeting
end
end
Here is my view in c:\ruby\hello\app\views\app\greeting.rhtml
Ruby on Rails
Yes its working!
Here is the URL that I’m trying to access it
http://localhost:3000/App/greeting
On Aug 19, 9:43 am, Frederick C. [email protected]
Your problem is a missmatch between the controller name and the view
directory name.
If you’re going to use application_controller.rb then c:\ruby\hello\app
\views\app\greeting.rhtml should be c:\ruby\hello\app\views
\application\greeting.rhtml.
You can use scaffold to help get more familiar with what goes where.
Try this:
script/generate scaffold User name:string profile:text
Now check for new files in app\controllers, app\views, app\models, and
db\migrations
Then run:
rake db:migrate
And restart your webserver and browse:
http://localhost:3000/users
Rick
Rick Lloyd wrote:
Your problem is a missmatch between the controller name and the view
directory name.
If you’re going to use application_controller.rb
But the OP is not using this name; he’s using app_controller.rb . And
this should be apps_controller : controller names are always plural.
then c:\ruby\hello\app
\views\app\greeting.rhtml should be c:\ruby\hello\app\views
\application\greeting.rhtml.
No. It should be app/views/app/greeting.html.erb , at least in recent
versions of Rails. What version of Rails are you using?
You can use scaffold to help get more familiar with what goes where.
Try this:
script/generate scaffold User name:string profile:text
That’s a good idea.
Rick
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
On Aug 19, 3:17 pm, mgpowers [email protected] wrote:
I did look at the log file and even posted the error message in the
very first post…
see…below…Any ideas ?
Oops, didn’t spot that. You may get a more verbose error if you try to
run
ruby script/console
Fred
Using rails 2.3.3
I’ve put greeting.rhtml in both
app\views\app
and
app\views\application
SAME result…Any other ideas ?
I’ve tried starting it in console mode but it just says Load Develope
Env >>
I’m trying to stay positive about Rails but am a little discouraged
that
I can get my first controller/view working :<
On Aug 19, 12:44 pm, Frederick C. [email protected]
I’ve changed the view name to greeting.html.erb as suggested
but SAME results…
I was jusing the book Beginging Ruby on Rails and
looking at the online documentation.
Any other suggestions ?
ok, so just to be complete, what do you get when you type:
rake routes
C:\Ruby\hello>rake routes
(in C:/Ruby/hello)
/:controller/:action/:id
/:controller/:action/:id(.:format)
On Aug 19, 1:42 pm, mgpowers [email protected] wrote:
SAME result…Any other ideas ?
As I said before, it should be greeting.html.erb , not
greeting.rhtml . Why are you using .rhtml ? That hasn’t been correct
for a long time, and it makes me think that you may be following a
tutorial for an older version.
I’ve tried starting it in console mode but it just says Load Develope
Env >>
Yes, that’s what it should say. What’s the problem?
I’m trying to stay positive about Rails but am a little discouraged
that
I can get my first controller/view working :<
What documentation have you been using?
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
When your http://localhost:3000 comes up, what do you see if you
follow the link “About_your_application’s_environment”?
I get:
Ruby version 1.8.7 (powerpc-darwin9.7.0)
RubyGems version 1.3.4
Rack version 1.0
Rails version 2.3.3
Active Record version 2.3.3
Action Pack version 2.3.3
Active Resource version 2.3.3
Action Mailer version 2.3.3
Active Support version 2.3.3
Application root /Users/rick/hello
Environment development
Database adapter sqlite3
Database schema version 0
Also, using your app_controller.rb and views/app/greeting.rhtml in
this environment does the right thing in response to
http://localhost:3000/app/greeting.
When I click on About Environment , I get
We’re sorry, but something went wrong
The log says
!\ FAILSAFE /!\ Fri Aug 21 08:06:58 -0400 2009
Status: 500- Internal Server Error
unknown error
Unfortunately its not telling much more which is a little frustrating.
I even downloaded ruby again , reinstalled rails . Then as before
it failed initially because of sqlite3 not being there which I
installed
but then I still get the same error message…
Any ideas ?
If I do a gem list , I get
actionmailer (2.3.3)
actionpack (2.3.3)
activerecord (2.3.3)
activeresource (2.3.3)
activesupport (2.3.3)
fxri (0.3.6)
fxruby (1.6.16)
hpricot (0.6.164)
log4r (1.0.5)
ptools (1.1.6)
rack (1.0.0)
rails (2.3.3)
rake (0.8.7, 0.8.1)
ruby-opengl (0.60.0)
sqlite-ruby (2.2.3)
sqlite3-ruby (1.2.1)
test-unit (2.0.1)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)
mgpowers, do one thing. Create a new rails application mgp
rails mgp
cd mgp
ruby script/create controller myfirst greeting
in myfirst controller greeting action put
def greeting
@n = “I am mgp”
end
in app\views\myfirst\greeting.html.erb put this
Yes its working! <%=@n%>
remove your \public\index.html
Now start server – ruby script/server (you should be inside your mgp
directory)
goto http://localhost:3000/myfirst/greeting
you should get appropriate results.
let me know how it goes.
http://www.classifiedscript.in
Free Craigslist Classified Script
Thanks for all the support…I am really trying to hang in there
especially since there appears to be
many good things with Rails but it is hard not knowing exactly why its
failing…Here is what happened
when I tired creating the contollter…
C:\Ruby\mgp>ruby script/create controller myfirst greeting
ruby: No such file or directory – script/create (LoadError)
C:\Ruby\mgp>ruby script\create controller myfirst greeting
ruby: No such file or directory – script/create (LoadError)
C:\Ruby\mgp>dir
Volume in drive C has no label.
Volume Serial Number is 0C3F-B4D3
Directory of C:\Ruby\mgp
08/21/2009 10:13 AM .
08/21/2009 10:13 AM …
08/21/2009 10:13 AM app
08/21/2009 10:13 AM config
08/21/2009 10:13 AM db
08/21/2009 10:13 AM doc
08/21/2009 10:13 AM lib
08/21/2009 10:13 AM log
08/21/2009 10:13 AM public
08/21/2009 10:13 AM 307 Rakefile
On Aug 21, 9:28 am, Rails L. [email protected]
http://www.buildingwebapps.com/learningrails
Start here with your first app. Download and follow all the screencasts
I think that was a typo in Rails L.'s post, it should have been
ruby script/generate controller myfirst greeting
Colin
Ooops. Colin was right. It was a typo.
2009/8/21 mgpowers [email protected]:
Thanks for all the support…I am really trying to hang in there
especially since there appears to be
many good things with Rails but it is hard not knowing exactly why its
failing…Here is what happened
when I tired  creating the contollter…
C:\Ruby\mgp>ruby script/create controller myfirst greeting
ruby: No such file or directory – script/create (LoadError)
I think that was a typo in Rails L.'s post, it should have been
ruby script/generate controller myfirst greeting
Colin