Created
April 23, 2015 15:43
-
-
Save arbarlow/d48b71421fba0f7cd6d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"net/http" | |
"github.com/go-martini/martini" | |
"github.com/jinzhu/gorm" | |
"github.com/martini-contrib/render" | |
. "github.com/madebymany/riru/models" | |
) | |
func PhotosControllerRouter(r martini.Router) { | |
r.Get("", PhotosIndex) | |
} | |
func PhotosIndex(r render.Render, db gorm.DB, user User, reel *Reel) { | |
var photos []Photo; | |
db.Model(&reel).Related(&photos) | |
r.JSON(http.StatusOK, photos) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment