When you have a rails resource defined rails seems to automatically create a params entry of attributes for that resource. e.g. if my model Lesson has a subject attribute and I post subject=Maths it automatically creates the param[lesson] = { subject: 'Hello' }. The problem I am having is getting nested attributes to appear within this created lesson array.
I'm using mongoid as my backend and have an association on Lesson called activities. The code looks like this:
class Lesson
  include Mongoid::Document
  field :subject, type: String
  embeds_many :activities, class_name: 'LessonActivity' do
    def ordered
      @target.sort { |x, y| x.display_order <=> y.display_order }
    end
    def reorder!
      @target.each_with_index { |val, index| val.display_order = index }
    end
  end
  accepts_nested_attributes_for :activities
However I can't work out how I access this activities from within params.require(:lesson).permit :activities
I can access it via params.permit(:activities) but that feels a bit messy
 
     
     
    