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

13 views
Skip to first unread message

Sailatha Kashamoni

unread,
Mar 9, 2015, 7:52:42 AM3/9/15
to rubyonra...@googlegroups.com




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'>
<div class='column top'>
<a class='icon_text_button' href="javascript:;"> 
<span class='icon'>
&#59146;
</span>
<span class='text'>
<%= @blog_post.view_count %>
</span>
</a>

   app/models/atom.rb:
                                   
                                        def count_view!
                                          self.inc(:view_count, 1)
                                          self.update_index
                                              end


app\views\home\index\_report.html.erb:

                                   

<div class='buttons'>
<a class='icon_text_button' href='<%= research_article_path(:url_fragment => atom.url_fragment) %>'>
<span class='icon'>
&#59146;
</span>
<span class='text'>
<%= abbreviated_number(atom.view_count) %> <%= atom.view_count == 1 ? 'view' : 'views' %>
</span>
</a>

        

Colin Law

unread,
Mar 9, 2015, 8:02:06 AM3/9/15
to rubyonra...@googlegroups.com
On 9 March 2015 at 11:52, Sailatha Kashamoni
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
Reply all
Reply to author
Forward
0 new messages