开发者 | filosofo |
---|---|
更新时间 | 2014年3月24日 22:48 |
捐献地址: | 去捐款 |
PHP版本: | 3.8 及以上 |
WordPress版本: | 3.8 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
wp-restful-single-sign-on
to the /wp-content/plugins/
directoryDevise no longer responds to JSON out of the box, and for good reason: responding with the resource typically returns way too much information. So if you enable JSON responses, make sure that your resource exposes only the properties it should (more info below).
in config/application.rb
add the following:
config.to_prepare do DeviseController.respond_to :html, :json end
If your Devise resource is the User
model, add something like the following method to app/models/user.rb
:
def as_json options={} { email: self.email, first_name: self.first_name, last_name: self.last_name, } end
This returns only the email, first name, and last name User
properties.