Advertisement
Guest User

Untitled

a guest
Dec 29th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class Section < ActiveRecord::Base
  2. belongs_to :course
  3. has_many :quizzes, foreign_key: "lesson_id"
  4. has_many :lessons, foreign_key: "section_id"#, :inverse_of => :sections
  5. accepts_nested_attributes_for :lessons
  6.  
  7. rails_admin do
  8. create do
  9. field :course do
  10. default_value do
  11. Course.last.id
  12. end
  13. end
  14. field :title
  15. end
  16.  
  17. edit do
  18. field :course do
  19. default_value do
  20. Course.last.id
  21. end
  22. end
  23. field :title
  24. end
  25. end
  26.  
  27. rails_admin do
  28. configure :lessons do
  29. field :title # This is the line that is giving the error
  30. field :body
  31. field :image
  32.  
  33. end
  34. end
  35.  
  36. end
  37.  
  38. class Lesson < ActiveRecord::Base
  39.  
  40. belongs_to :section #, foreign_key: "section_id"#, :inverse_of => :lessons
  41. has_many :posts, foreign_key: "lesson_id"
  42. has_one :quiz, :inverse_of => :lesson
  43. accepts_nested_attributes_for :quiz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement