Skip to content

Using parent ids in the embedded document path for an attachment #61

Description

@Vrael

I want save an attachment in a path such as:

rails_root/parent/:id_parent/child/:id_child/:filename
class Parent
  include Mongoid::Document
  embeds_many :childrens , cascade_callbacks: true
end

class Child
  include Mongoid::Document
  include Mongoid::Paperclip
  embedded_in :parent, inverse_of: :childrens
  has_mongoid_attached_file :photo,
       path: "parent/:id_parent/child/:id/:filename"
end

How can I use :id_parent? Because right now is undefined and it should have parent ids value.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions