0

I'm trying to create a description page for blog post authors. I've created a route:

mount Monologue::Engine, at: '/blog'

#create routes for monologue
Monologue::Engine.routes.draw do
    get 'p/:name', to: 'authors#show', as: :author
end

And I've created a controller in app/controllers/monologue:

class Monologue::AuthorsController
    def show
        puts "in show method"
    end
end

I keep getting this error:

undefined method `action' for Monologue::AuthorsController:Class

Long story short: how do I generate a controller within monologue?

Philip7899
  • 4,599
  • 4
  • 55
  • 114
  • What's your output from $rake routes from the app where you are mounting the engine? – Elvn Dec 04 '15 at 22:05

1 Answers1

-1
Monologue::Engine.routes.draw do
  get '/posts/:author_id', to: "posts#author_posts", as: "author_posts"
end

class Monologue::PostsController < Monologue::ApplicationController
  def author_posts
    @posts = Monologue::Post.where(:user_id => params[:author_id],).order(created_at: :desc)
    @author = Monologue::User.find_by_id(params[:author_id])
  end
end

This is how you add a controller action.