Access MIME types via hash lookup instead of constant

Use a constant to look up a mime type is deprecated.

Co-Authored-By: Dan Rice <dnrce@users.noreply.github.com>
This commit is contained in:
Matt Rogers 2018-11-03 14:50:30 -05:00
parent 2f85a42f91
commit 7fe0cf271a
No known key found for this signature in database
GPG key ID: 605D017C07EB4316
4 changed files with 13 additions and 13 deletions

View file

@ -17,7 +17,7 @@ class CalendarController < ApplicationController
cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
} }
format.ics { format.ics {
render :action => 'show', :layout => false, :content_type => Mime::ICS render :action => 'show', :layout => false, :content_type => Mime[:ics]
} }
format.xml { format.xml {
render :xml => @due_all.to_xml( *todo_xml_params ) render :xml => @due_all.to_xml( *todo_xml_params )

View file

@ -26,9 +26,9 @@ class ContextsController < ApplicationController
@feed_description = "Lists all the contexts for #{current_user.display_name}" @feed_description = "Lists all the contexts for #{current_user.display_name}"
end end
format.text do format.text do
# somehow passing Mime::TEXT using content_type to render does not work # somehow passing Mime[:text] using content_type to render does not work
headers['Content-Type']=Mime::TEXT.to_s headers['Content-Type']=Mime[:text].to_s
render :action => 'index', :layout => false, :content_type => Mime::TEXT render :action => 'index', :layout => false, :content_type => Mime[:text]
end end
format.autocomplete &render_autocomplete format.autocomplete &render_autocomplete
end end

View file

@ -43,8 +43,8 @@ class ProjectsController < ApplicationController
@feed_description = I18n.t('models.project.feed_description', :username => current_user.display_name) @feed_description = I18n.t('models.project.feed_description', :username => current_user.display_name)
end end
format.text do format.text do
# somehow passing Mime::TEXT using content_type to render does not work # somehow passing Mime[:text] using content_type to render does not work
headers['Content-Type']=Mime::TEXT.to_s headers['Content-Type']=Mime[:text].to_s
end end
format.autocomplete do format.autocomplete do
projects = current_user.projects.active + current_user.projects.hidden projects = current_user.projects.active + current_user.projects.hidden
@ -114,9 +114,9 @@ class ProjectsController < ApplicationController
@projects = current_user.projects.active @projects = current_user.projects.active
respond_to do |format| respond_to do |format|
format.text { format.text {
# somehow passing Mime::TEXT using content_type to render does not work # somehow passing Mime[:text] using content_type to render does not work
headers['Content-Type']=Mime::TEXT.to_s headers['Content-Type']=Mime[:text].to_s
render :action => 'index_text_projects_and_actions', :layout => false, :content_type => Mime::TEXT render :action => 'index_text_projects_and_actions', :layout => false, :content_type => Mime[:text]
} }
end end
end end

View file

@ -43,9 +43,9 @@ class TodosController < ApplicationController
render :action => 'index'.freeze render :action => 'index'.freeze
end end
format.text do format.text do
# somehow passing Mime::TEXT using content_type to render does not work # somehow passing Mime[:text] using content_type to render does not work
headers['Content-Type'.freeze]=Mime::TEXT.to_s headers['Content-Type'.freeze]=Mime[:text].to_s
render :content_type => Mime::TEXT render :content_type => Mime[:text]
end end
format.xml do format.xml do
@xml_todos = params[:limit_to_active_todos] ? @not_done_todos : @todos @xml_todos = params[:limit_to_active_todos] ? @not_done_todos : @todos
@ -670,7 +670,7 @@ class TodosController < ApplicationController
cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
} }
format.text { format.text {
render :action => 'index', :layout => false, :content_type => Mime::TEXT render :action => 'index', :layout => false, :content_type => Mime[:text]
} }
end end
end end