0

I cannot see the apps running using 'Preview'.

The Ruby environment with the Rails framework is installed (able to see folders and files generated), and see application being built in Nitrous.IO IDE.

My installation shows I have the following installed:
- ruby 2.1.1p76
- Rails 4.1.0
- git version 2.0.0
- SQLite3

Building a simple blog app, I use the scaffold generator to create the MVC components needed for posts and comments:

1. $ rails generate scaffold post title:string body:text
2. $ rails generate scaffold comment post_id:integer body:text

I create the post and comment database tables using:

1. $ rake db:migrate
2. $ rake routes
3. $ rails server

Using 'Preview' to see app running on WEBrick, only get default webpage which says:
- "Routes are set up in the config/routes.rb"
- "running in development mode and haven't set a root route yet."

config/routes.rb file has the following:

     Rails.application.routes.draw.do
resources :comments
resources :posts
# lines 6 -> 59 are comments giving coding examples of routes
end

==>> What do I need to do to 'Preview' Ruby apps??

  • Have you taken a look at http://help.nitrous.io/preview/#ruby-on-rails-example ? – Mark Silverberg Aug 24 '14 at 00:01
  • Yes, I have read this tutorial about using preview and notice that the Preview URL follows the convention given in the example.

    Part of the output from the WEBrick server running shows port=3000, so and the example says that, "Port 3000 is automatically forwarded to port 80. This means if your app is running on port 3000 then you will not need to include a port in the address bar."

    I've tried it with and without the 'port' descripter, and just get the default webpage, so No Joy for me yet.
    – Wayne Ryder Aug 24 '14 at 01:15
  • Please clarify what you mean by default webpage. Default rails or default nitrous? – Mark Silverberg Aug 24 '14 at 02:51
  • It is the default rails webpage on Nitrous.IO, with the RubyOnRails logo in top left corner and the heading "Welcome aboard" "You're riding Ruby on Rails!" It has a single link right under the main heading, "About your application's environment", followed by "Getting started, Here's how to get rolling:" then a number list of 3 items to be aware of. Is there a way I can add a screen pic in the comments so I can show it?? – Wayne Ryder Aug 24 '14 at 15:46

2 Answers2

0

Based on your comment above, I believe what you need to do is remove the public/index.html file and/or go to the route(s) you have created and specify one of them as root.

Also see this SO question and it's answer(s): deploying to heroku -- can't get rid of the "welcome to rails" default page

Community
  • 1
  • 1
Mark Silverberg
  • 1,249
  • 2
  • 8
  • 21
0

After you run rake routes command, it creates all the REST calls for you i.e. GET/POST/PUT/DELETE and as you have already created the scaffold you just need to invoke URL with the paths as /comment or /post and you will be able to access your blog application.

Ex: http://yourhost.com:3000/comment or http://yourhost.com:3000/post.

vdenotaris
  • 13,297
  • 26
  • 81
  • 132