impressionist
impressionist copied to clipboard
Model name is not detected properly
I have a model called Blog::Post and I'd like to count impressions for it. The controller is named according to the convention: Blog::PostsController. In this scenario impressionist will set impressionable_type to Post because of the following implementation:
def direct_create_statement(query_params={})
query_params.reverse_merge!(
:impressionable_type => controller_name.singularize.camelize,
:impressionable_id=> params[:id]
)
associative_create_statement(query_params)
end
But it should be "Blog::Post". Therefore I'd suggest to use controller_path instead of controller_name to detect impressionable_type
It would even be better if impressionist method of controller accepts options to manually set model name because sometimes a model without namespace(Post) might be used in a controller with namespace(Admin::PostsController)
I know this is years later - but in case anyone like me comes across this issue via google while trying to get namespaced controllers logged, this functionality was actually added in #71, but removed again in ce935aaa38c21aef13bbdb4efc34332fcfb5b4c0