ruby on rails - Rails4 Jbuilder templates not being found -


i trying setup simple json response using jbuilder. controller follows:

class api::v1::jobscontroller < api::v1::basecontroller    def show       @job = job.find(params[:id])    end end 

i have jbuilder template here:

views\api\v1\jobs\show.json.jbuilder

for reason when loading page in browser or postman controller hit, jbuilder template not found. a:

rendered text template (0.5ms) completed 404 not found in 298ms

if modify show action on jobs controller , add render json: @job desired output, of course isn't using jbuilder template.

can't figure out why isn't seeing jbuilder template!

added addition details if go .json url

started "/api/v1/jobs/69407.json" 127.0.0.1 @ 2016-01-21 19:16:44 -0500 processing api::v1::jobscontroller#show json   parameters: {"id"=>"69407"}   job load (18.3ms)  select  "jobs".* "jobs" "jobs"."id" = $1 limit 1  [["id", 69407]]   rendered text template (0.5ms) completed 404 not found in 86ms (views: 1.1ms | activerecord: 56.4ms) 

update - have found if reference jbuilder template loads:

render 'show', formats: [:json], handlers: [:jbuilder], status: 200

also - in order above work, had add jbuilder gem gem file - odd on rails 4 should include default?

what think might have put respond_to :json in application controller or base controller. default html , see rendered text template.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -