Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render YAML in Rails 3

Is there anyway to respond_to a .yml file extension?

I have tried, but can't get it to work.

respond_to do |format|
      format.xml # index.xml.builder
      format.yml {render :text => @labels.to_yaml, :content_type => 'text/yaml'}
    end

The above code spits out the following error uninitialized constant Mime::YML

like image 570
dennismonsewicz Avatar asked Feb 26 '23 13:02

dennismonsewicz


1 Answers

no need to add that stuff to environment.rb, just change format.yml to format.yaml and it will work.

like image 88
foomip Avatar answered Mar 13 '23 06:03

foomip