I'd like to publish rdf in my rails apps. What's the right way to do it?
(For people who are interested in working with actual RDF data, please see The State of RDF in Ruby.)
The short answer to your question: You're looking for respond_to. In general, you'd write something like:
class PeopleController < ApplicationController::Base
respond_to :html, :rdf
def index
@people = Person.all
respond_to do |format|
format.html
format.rdf { convert_to_rdf(@people) }
end
end
end
Of course, you'll have to write 'convert_to_rdf'. You might find that RDF.rb is helpful for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With