Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. App.Router.map ->
  2. @resource 'site', ->
  3. @route 'show', path: '/:site_id'
  4.  
  5. #routes.rb
  6. Rails.application.routes.draw do
  7. root to: 'home#index'
  8.  
  9. scope constraints: { format: :html } do
  10. get '/site' => 'home#index'
  11. get '/site/:site_id' => 'home#index'
  12. resources 'sites'
  13. end
  14. end
  15.  
  16. class SitesController < ApplicationController
  17. def show
  18. render json: File.open('data/sites.json').read
  19. end
  20. end
  21.  
  22. App.Site = DS.Model.extend()
  23.  
  24. {
  25. "site": [
  26.  
  27. {
  28.  
  29. "id": "1",
  30. "name": "Place One",
  31. "type": "Type One"
  32.  
  33. }, {
  34.  
  35. "id": "2",
  36. "name": "Place One",
  37. "type": "Type Two"
  38.  
  39. }
  40. ]
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement