It is difficult, I think. I have a comment controller that I would like to use for all my other controllers: for example, books, headings, etc.
The problem is creating the action in the comments:
def create
@book = Book.find(params[:book_id])
@comment = @book.comments.create!(params[:comment])
respond_to do |format|
format.html {redirect_to @book}
format.js
end
end
so how can I use an action and comment controller for headings if it explicitly uses book attributes?
source
share