Hi All,
I am new to ROR and I am experiencing a few problems viewing my first
app. Can anyone pls help me to get my first app up and running?
I created a rails application called my_app. I created a controller
called hello.
It looks something like this.
class HelloController < ApplicationController
def display
end
end
When I type http://localhost:3000/hello/display it says “we are sorry
but something went wrong” message. I know it is looking for a view and
when I created a view called display.rhtml with text “welcome on board”
without any html tags and reloaded the browser window instead of
displaying welcome on board in plain text it again is displaying “we are
sorry but something went wrong”.
can anyone pls let me know where I am going wrong?
Invest in the electronic PDF version of Agile Web D. with RoR
from the Pragmatic Programmer library.
(Assuming you have a database setup, I use MySQL, others use a different
backend)
In the root folder for your app, enter
ruby script/generate scaffold person first_name:string last_name:string
Explore the folder tree for your app and see what Rails has
auto-generated for you (all sorts of wonderful things… a migration, a
controller, some views, and an entry in routes.rb). Peruse this folder
structure and the files to see how things fit together in a ‘vanilla’
Rails application. Some may disparage the scaffold command, but it is
an excellent first step to see what Rails does by default. For
practically zero effort, you have a nice example of Rails written for
you.
Next steps would typically be something like:
Edit database.yml to talk to your database.
Run the migration (rake db:migrate).
Next, I’d recommend running “rake routes >routes.lst”, then look at
routes.lst to see what rails routing is all about.
Rename the default index.html in public to get it out of the way.
Start your server.
Navigate to http://localhost:3000/people
On Jul 24, 4:31 pm, Sam M. [email protected] wrote:
def display
can anyone pls let me know where I am going wrong?
Have a peek inside your app’s development.log for a better explanation
of what is wrong (I’m guessing its something like that app is set to
use an sqlite3 database but you don’t have sqlite3 (or its bindings
for ruby))
Alpha B. has been working on a thread that may help you as well:
http://www.ruby-forum.com/topic/191189#new
Sam, did you generate a scaffold, or a stand-alone controller?
When you go to localhost, do you see the generic ruby welcome page?
can you click on the configuration link?
doudou wrote:
Sam, did you generate a scaffold, or a stand-alone controller?
When you go to localhost, do you see the generic ruby welcome page?
can you click on the configuration link?
Thanks folks…I was following some online tutorial and I ran into some
confusing moments…Now that I am following the documentation at
rubyonrails.org everything seems to be ok and working now…
I’ll get back if I have any more doubts…
Thanks once again for your inputs…