0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

How To Set Up Devise AJAX Authentication With Rails 4.0

Last updated at Posted at 2016-12-21

なかなか賢い。

Controller.respond_to :json すると積み上がるのね確認

module ClassMethods
     def respond_to(*mimes)
       options = mimes.extract_options!
       only_actions   = Array(options.delete(:only))
       except_actions = Array(options.delete(:except))
       new = mimes_for_respond_to.dup
       mimes.each do |mime|
         mime = mime.to_sym
         new[mime]          = {}
         new[mime][:only]   = only_actions   unless only_actions.empty?
         new[mime][:except] = except_actions unless except_actions.empty?
       end
       self.mimes_for_respond_to = new.freeze
     end
     def clear_respond_to
       self.mimes_for_respond_to = ActiveSupport::OrderedHash.new.freeze
     end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?