خرید بک لینک

Vote count: 0

I've been having trouble with capturing the data related to the current_user, and then graphing it. I will post the code that I've written and error that I've been experiencing below.

I'm receiving the error below, even though the view itself loads

Error Loading Chart: Inteal Server Error

Index.html.erb

<%= line_chart analytic_posts_created_path(current_user) %>

Analytics_Controller.rb

class AnalyticsController < ApplicationController
  before_filter :authenticate_user!

  def index
    posts_created
  end

  def posts_created
    render jsons: current_user.posts.group_by_month(:created_at).count
  end

  private
  def set_user
    @user = User.friendly.find(params[:id])
  end
end

routes.rb

resources :analytics, only: [:index] do
    get '/posts_created' => 'analytics#posts_created'
  end

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 11 فروردين 1395 ساعت: 3:30

صفحه بندی