Bug on blog - number of views not showing in ruby on rails app.below is the code used

app/assets/javascripts/blog/show.js.erb:

     $(document).ready(logView);
            function logView() {

var id = $(‘div.blog_post’).data(‘id’);
InternalAnalytics.postEvent(id, ‘view’);
}
app/views/blog/show.html.erb:

               <div class='column'>
<%= @blog_post.view_count %>

app/models/atom.rb:

                                    def count_view!
                                      self.inc(:view_count, 1)
                                      self.update_index
                                          end

app\views\home\index_report.html.erb:

<%= abbreviated_number(atom.view_count) %> <%= atom.view_count == 1 ? 'view' : 'views' %>

On 9 March 2015 at 11:52, Sailatha Kashamoni
[email protected] wrote:

InternalAnalytics.postEvent(id, ‘view’);

<%= abbreviated_number(atom.view_count) %> <%= atom.view_count == 1 ? 'view' : 'views' %>

I don’t see a question there.

Assuming you have some sort of problem with the code then first look
at the logs, debug the code to find where the problem is, use
something like firebug to check the javascript is ok, and then if
something is not working as you expect ask a specific question.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs