Reputation: 4126
Im trying to folow some base pointers of this guide : http://rockyj.in/2013/10/24/angular_rails.html
ive created a controller named PeopleController :
module Api
module V1
class PeopleController < ApplicationController
def greet
render :json => {message: "Hello World!"}.as_json
end
end
end
end
in this controller there si a simple greet method which return Hello world as json when its called.
My route:
Rails.application.routes.draw do
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
get "/greet" => "people#greet", :as => 'greet'
end
end
end
so if i call this url i should get json response : /api/v1/greet.json but instead i am getting uninitialized constant Api, and after about 4 hours of struggle i really cant find out what i did wrong.
What is it that i've done wrong?
Upvotes: 0
Views: 902