mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Properly indent code example block
This commit is contained in:
parent
b31ef7ee83
commit
1a051259b4
1 changed files with 23 additions and 23 deletions
|
@ -20,33 +20,33 @@ module ActiveModel
|
|||
# For example, a logged in user may need to assign additional attributes depending
|
||||
# on their role:
|
||||
#
|
||||
# class AccountsController < ApplicationController
|
||||
# include ActiveModel::MassAssignmentSecurity
|
||||
# class AccountsController < ApplicationController
|
||||
# include ActiveModel::MassAssignmentSecurity
|
||||
#
|
||||
# attr_accessible :first_name, :last_name
|
||||
# attr_accessible :first_name, :last_name
|
||||
#
|
||||
# def self.admin_accessible_attributes
|
||||
# accessible_attributes + [ :plan_id ]
|
||||
# end
|
||||
#
|
||||
# def update
|
||||
# ...
|
||||
# @account.update_attributes(account_params)
|
||||
# ...
|
||||
# end
|
||||
#
|
||||
# protected
|
||||
#
|
||||
# def account_params
|
||||
# sanitize_for_mass_assignment(params[:account])
|
||||
# end
|
||||
#
|
||||
# def mass_assignment_authorizer
|
||||
# admin ? admin_accessible_attributes : super
|
||||
# end
|
||||
#
|
||||
# def self.admin_accessible_attributes
|
||||
# accessible_attributes + [ :plan_id ]
|
||||
# end
|
||||
#
|
||||
# def update
|
||||
# ...
|
||||
# @account.update_attributes(account_params)
|
||||
# ...
|
||||
# end
|
||||
#
|
||||
# protected
|
||||
#
|
||||
# def account_params
|
||||
# sanitize_for_mass_assignment(params[:account])
|
||||
# end
|
||||
#
|
||||
# def mass_assignment_authorizer
|
||||
# admin ? admin_accessible_attributes : super
|
||||
# end
|
||||
#
|
||||
# end
|
||||
#
|
||||
module ClassMethods
|
||||
# Attributes named in this macro are protected from mass-assignment
|
||||
# whenever attributes are sanitized before assignment.
|
||||
|
|
Loading…
Reference in a new issue