I have a svg image on /app/asssets/images/symbols.svg with this as contents.
Specifically include the SVG filetype in asset compilation
production.rb
config.assets.precompile += %w( '.svg' )
# Must include to get inline SVGs to work in deploy
config.assets.css_compressor = :sass
Create a helper to display the SVG
myhelper.rb
def show_svg(path)
File.open("app/assets/images/#{path}", "rb") do |file|
raw file.read
end
end
Invoke the SVG processing helper in your view
<%= show_svg('symbols.svg') %>
From your question I'm not 100% clear about your implementation, but these steps should get you to the point where your SVG image is visible. Once you have the SVG visible, you can apply CSS.