Search code examples
ruby-on-railsxmleclipsecatalog

display from xml file in a webpage


Update: I managed using sinatra.

In my rails application I have an xml file . I want to display it like this: eclipse catalog

How can I do it ? I managed to display only as text . Thank you!


Solution

  • As you have xml file, write in controller

    filepath = "#{Rails.root}/file/to/path"
    send_file filepath, disposition: 'inline'
    

    :disposition option is important! Because specifies whether the file will be shown inline or downloaded. Valid values are 'inline' and 'attachment' (default).