Reputation: 4728
I am new to rails dev and is looking to use https://github.com/charlotte-ruby/impressionist but not able to figure out how to use it looking at its documentation. I have done the migration and when trying to put
class ArticlesController < InheritedResources::Base
impressionist
end
OR
class ArticlesController < InheritedResources::Base
impressionist :actions=>[:show,:index]
end
it is throwing no method found error. I am unsure which code needs to be put in model, which to be in controller and which to be in views to see view_count, any help ?
Upvotes: 1
Views: 2272
Reputation: 66
You can also use Impression
as a model to query stuff, just like normal models. For example,
Impression.where(user_id: 12).length
I find this is handy if you need some advanced queries.
Upvotes: 1
Reputation: 6217
The documentation does not specify to re-start server. This is not obvious as it does not apply to all gems, however it is required for impressionist.
Upvotes: 0
Reputation: 5489
the first question was a type
and as for your second question (inside the comment) the easiest but very efficient way would be
in the view:
<% @pages.each do |page| %>
<%= page.impressionist_count %>
<% end %>
Upvotes: 1