Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <div>
  2. <aside class="col-md-4">
  3. <div>
  4. <h1>My Profile</h1>
  5. </div>
  6. <div class="hero-unit user_info">
  7. <h1><%= @user.name %></h1>
  8. <h2><%= pluralize(@user.cars.count, "Car") %></h2>
  9. </div>
  10. </aside>
  11.  
  12. <div class="col-md-8">
  13. <h1>My Cars</h1>
  14. </div>
  15. <div class="col-md-8">
  16. <div id="car_feed">
  17. <ul class="cars">
  18. <%= render @feed_items %> //problem point
  19. </ul>
  20. </div>
  21. </div>
  22. </div>
  23.  
  24. class User < ActiveRecord::Base
  25. has_many :cars
  26. attr_accessor :remember_token
  27. before_save { self.email = email.downcase }
  28. validates :name, presence: true, length: { maximum: 50 }
  29. VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-.]+.[a-z]+z/i
  30. validates :email, presence: true, length: { maximum: 255 },
  31. format: { with: VALID_EMAIL_REGEX },
  32. uniqueness: { case_sensitive: false }
  33. has_secure_password
  34. validates :phone, presence:true
  35. validates :password, length: { minimum: 6 }, allow_blank: true
  36.  
  37. .
  38. .
  39. .
  40.  
  41. def feed
  42. Car.where("user_id = ?", id)
  43. end
  44. end
  45.  
  46. def home
  47. if logged_in?
  48. @car = current_user.cars.build
  49. @feed_items = current_user.feed.paginate(page: params[:page])
  50. end
  51. end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement