0

I am trying to create a static page. I typed $ rails generate controller StaticPages home help --no-test-framework and got the output below.

    conflict  app/controllers/static_pages_controller.rb
Overwrite   
/Users/themaktravels/rails_projects/sample_app/app/controllers/static_pages_controller.rb?   (enter "h" for help) [Ynaqdh] d
  class StaticPagesController < ApplicationController
-   def ...
+   def home
+   end
+ 
+   def help
    end
  end
Retrying...

I tried to see what the difference is, but I am not familiar with this to understand what the difference is. When I tried to not overwrite the file and then tested the URL, I got this error on my page.

Routing Error

No route matches [GET] "/static_pages/home"

Try running rake routes for more information on available routes.

I then tried to checkout my changes with GIT and then tried to run rake routes

bundle update rake

bundle show rake 

require 'rake/dsl_definition'

But my static page still shows an error. Any suggestions? Thank you!

LearningHowToCode
  • 125
  • 1
  • 2
  • 8
  • what did u get when do rake routes ? you have an error saying no routes matches most probably you don't have mention any routes in routes file. – Muhamamd Awais Nov 27 '12 at 06:01

1 Answers1

0

Add this to your routes file

config/routes.rb

get "static_pages/home"
get "static_pages/help"

HTH

sameera207
  • 16,547
  • 19
  • 87
  • 152