app/models/passage.rb
##
# attaches a text file with the selected section as content
# @param text [String] the selected section of the original text file
attaches a text file with the selected section as content
attaches a text file with the selected section as content
def save_text_passage(text)
      Tempfile.open("text_passage") do |f|
        f.write(text)
        f.rewind
        file.attach(io:           f,
                    filename:     "#{name}.txt",
                    content_type: "text/plain")
      end
    end
def save_text_passage ( text ) Tempfile . open ( "text_passage" ) do | f | f . write ( text ) f . rewind file . attach ( io : f , filename : "#{name}.txt" , content_type : "text/plain" ) end end
attaches a text file with the selected section as content
attaches a text file with the selected section as content
text
the selected section of the original text file
the selected section of the original text file