Created
December 12, 2011 13:50
-
-
Save hugopeixoto/1467236 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
#include "app/controllers/posts.h" | |
#include "http/request.h" | |
#include "helpers/core.h" | |
// views | |
#include "app/views/posts/index.cc" | |
#include "app/views/posts/show.cc" | |
using app::controllers::PostsController; | |
PostsController::PostsController () : super("posts") | |
{ | |
add_action("index", &PostsController::index, &view_posts_index); | |
add_action("show", &PostsController::show, &view_posts_show); | |
} | |
void PostsController::index () | |
{ | |
model::Post* post = model::Post::find(params.get<std::string>("id")); | |
params.set("post", post); | |
} | |
void PostsController::show () | |
{ | |
model::Post* post = model::Post::find(params["id"]); | |
params.set("post", post); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment