Guest User

Untitled

a guest
Jan 23rd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class DashboardController < ApplicationController
  2. before_filter :authorize
  3.  
  4. def index
  5. @user = current_user
  6. end
  7. end
  8.  
  9. dashboard.js.erb
  10.  
  11.  
  12. (function(jQuery){
  13.  
  14. /*****************************
  15. * *
  16. * Model Section *
  17. * *
  18. *****************************/
  19.  
  20. window.Navigation = Backbone.Model.extend({});
  21.  
  22. window.navigation = new window.Navigation({
  23. activebutton: 'Reports',
  24. // This is the offending line
  25. properties: <%= @user.properties.map {|p| {name: p.name, id: p.id}}.to_json %>
  26. });
  27.  
  28.  
  29. The Error
  30.  
  31. NoMethodError in Dashboard#index
  32.  
  33. Showing /Users/jkay/Sites/owner_portal/app/views/layouts/application.html.erb where line #6 raised:
  34.  
  35. undefined method `properties' for nil:NilClass
  36. (in /Users/jkay/Sites/owner_portal/app/assets/javascripts/dashboard.js.erb)
Add Comment
Please, Sign In to add comment