Problems in Ruby first app

36 views
Skip to first unread message

Alvaro Naves

unread,
Mar 28, 2016, 7:07:26 PM3/28/16
to RubyInstaller
Hi, I´m iniciating in Ruby. 
After instalattion ( Ruby and DevKit ) and trying to run a simple example: 

When I use localhost:3000/test I get a page not found
When I use localhost:3000/test.js the browser can find ONLY the first page. No navigation, like trying to insert data on the first row. 

Can anyone help me ? 
Tks in advance. 

Bryan Bibat

unread,
Mar 28, 2016, 7:36:36 PM3/28/16
to rubyin...@googlegroups.com

Ruby is not Rails. What tutorial are you following?

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyinstalle...@googlegroups.com.
To post to this group, send email to rubyin...@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyinstaller.
For more options, visit https://groups.google.com/d/optout.

Alvaro Naves

unread,
Mar 29, 2016, 10:38:50 AM3/29/16
to RubyInstaller
Yes, Ruby is not Rails. 

I can get the welcome page from RubyOnRails with localhost:3000. 
One step ahead, when I try an app using scaffold, rake db:migrate and so on, when I type localhost:3000/app  I got an error. ( the same ) If I type localhost:3000/app.js the app first page is ok, but can´t navigate on it..

I´ve been looking in the internet for Ruby first app or some like that and tryed several..

Some suggestion for a simple app ? 
Tks

Bryan Bibat

unread,
Mar 29, 2016, 5:02:21 PM3/29/16
to rubyin...@googlegroups.com
Again, what tutorial are you trying?

I'm asking because your URLs are not the expected URLs for a scaffold. A good tutorial will tell you that if you run scaffold, the URL would be plural because you're creating a RESTful resource. Therefore, "rails generate scaffold app field1 field2" will give you a route at localhost:3000/apps.

Also, I tried replicating your problem in the latest version of Rails (4.2). I didn't get a "page not found", I got a "No route matches [GET] /app". localhost:3000/apps and localhost:3000/apps.js work just fine.

What do you mean by "can find ONLY the first page"? Is there a "New App" link that isn't working? Or is it a different looking page from the screenshot in the tutorial you're following?

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyinstalle...@googlegroups.com.
To post to this group, send email to rubyin...@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyinstaller.
For more options, visit https://groups.google.com/d/optout.



--
Bryan Bibat
Freelance Software Engineer
http://www.bryanbibat.net

Alvaro Naves

unread,
Apr 3, 2016, 11:51:43 AM4/3/16
to RubyInstaller
Ok Bryen. 

You are right about the name of app. I tryed localhost:3000/app1s. 
The return I got: 

No route matches [GET] "/app1s"


Can you help me ? 
 

Em segunda-feira, 28 de março de 2016 20:07:26 UTC-3, Alvaro Naves escreveu:

Bryan Bibat

unread,
Apr 3, 2016, 2:46:30 PM4/3/16
to rubyin...@googlegroups.com
The table below the error should tell you what paths/routes are available.

For example:
Inline image 1
The apps_path "/apps(.:format)" entry means that the "localhost:3000/apps" path is available. Same goes with  "/apps/new(.:format)" (localhost:3000/apps/new), "/apps/:id(.:format)" (localhost:3000/apps/[id]), and "/apps/:id/edit(.:format)" (localhost:3000/apps/[id]).

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyinstalle...@googlegroups.com.
To post to this group, send email to rubyin...@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyinstaller.
For more options, visit https://groups.google.com/d/optout.

Alvaro Naves

unread,
Apr 4, 2016, 4:33:20 PM4/4/16
to RubyInstaller
Hi Bryan. 
Now I can show "Hello World" page with localhost:3000. 

I had to change routes.rd

  # You can have the root of your site routed with "root"
  root 'home#index'

I had to change Index.html.erb

<h1>Hello World !</h1> 

and aplication.html.erb
....
  <title>Blog</title>
  <%= stylesheet_link_tag    'default', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
....

It was hard to find it all. 
The Tutorial with code examples I´m using is Guides.RubyonRails.org. Could you suggest me another one ? 


Thanks for your attention.  

Regards

Em segunda-feira, 28 de março de 2016 20:07:26 UTC-3, Alvaro Naves escreveu:
Reply all
Reply to author
Forward
0 new messages