So, I'm trying to add a rss feed into my rails 4 app, following this tuto, but I'm struggling with a ActionController::UnknownFormat that I understand it's happening in my controller.
hacks_controller.rb
def index
@hacks = Hack.order('id desc').paginate(:page => params[:page], per_page: 5)
end
def feed
@hacks = Hack.where(:active => true)
respond_to do |format|
format.atom { render :template => 'feed.atom.builder', :layout => false }
end
end
feed.atom.builder
atom_feed {language: 'en-US', url: root_url} do |feed|
feed.title "My own blog title"
feed.updated @hacks.maximum(:created_at)
@hacks.each do |hack|
feed.entry hack, {published: hack.created_at, updated: hack.updated_at} do |entry|
entry.title hack.title
entry.content post.text, type: 'html'
end
end
end
I have tried changing
format.atom { render :template => 'feed.atom.builder', :layout => false }
to
format.atom { render :layout => false }
But still not working. The trace is
ActionController::UnknownFormat - ActionController::UnknownFormat:
actionpack (4.1.1) lib/action_controller/metal/mime_responds.rb:440:in `retrieve_collector_from_mimes'
actionpack (4.1.1) lib/action_controller/metal/mime_responds.rb:256:in `respond_to'
() Users/javier/Desktop/definitive/app/controllers/hacks_controller.rb:14:in `feed'
actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.1.1) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.1) lib/active_support/callbacks.rb:113:in `call'