I try to use draper, decent_exposure and decent_decoration gems in my project, but something is not working correctly. It's strange, because I just copied this code from antoher project.
my controller is:
class PostsController < ApplicationController
expose_decorated(:post)
expose_decorated(:posts)
def create
if post.save
redirect_to post_path(post)
else
render :new
end
end
def update
if post.update(post_params)
redirect_to post_path(post)
else
render :edit
end
end
def destroy
post.destroy
redirect_to posts_path
end
private
def post_params
params.require(:post).permit(:title, :content)
end
end
and here is index view
%h1 Blog
- posts.each do |post|
%p= post.title
%p= post.content
and I'm getting this error:
undefined method `map' for #<Post:0x007f7df88dcca0>
Did you mean? tap
I figured it out. I didn't work, because I was using version 3.0.0 of decent_exposure while decent_decoration is compatible with version >= 2.0.
I changed the version of decent_exposure to 2.3 and it works as it should.