Skip to content

Instantly share code, notes, and snippets.

@hugopeixoto
Created December 12, 2011 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugopeixoto/1467236 to your computer and use it in GitHub Desktop.
Save hugopeixoto/1467236 to your computer and use it in GitHub Desktop.
#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