0
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

How To Set Up Devise AJAX Authentication With Rails 4.0

なかなか賢い。

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

Register as a new user and use Qiita more conveniently

  1. You can follow users and tags
  2. you can stock useful information
  3. You can make editorial suggestions for articles
What you can do with signing up
0
Help us understand the problem. What are the problem?