Module: DmCore::PermittedParams

Instance Method Summary collapse

Instance Method Details

#account_paramsObject




5
6
7
# File 'app/models/dm_core/permitted_params.rb', line 5

def 
  params.require(:account).permit! if current_user.try(:is_admin?)
end

#comment_paramsObject




41
42
43
# File 'app/models/dm_core/permitted_params.rb', line 41

def comment_params
  params.require(:comment).permit(:title, :body, :user_id)
end

#devise_sign_up_params(the_params) ⇒ Object




46
47
48
49
50
# File 'app/models/dm_core/permitted_params.rb', line 46

def (the_params)
  the_params.permit(:email, :password, :password_confirmation, :newsletter, :plan, :affiliate, 
                    user_profile_attributes: [:public_name, :first_name, :last_name, :public_avatar,
                                              :address, :address2, :city, :state, :zipcode, :country_id])
end

#user_paramsObject




10
11
12
13
14
15
16
# File 'app/models/dm_core/permitted_params.rb', line 10

def user_params
  if can? :manage, :all
    params.require(:user).permit!
  else
    params.require(:user).permit(:email, :password, :password_confirmation, :current_password)
  end
end

#user_profile_direct_params(the_params) ⇒ Object

used during a userless event registration




30
31
32
33
34
35
36
37
38
# File 'app/models/dm_core/permitted_params.rb', line 30

def (the_params)
  if can? :manage, :all
    the_params.permit!
  else
    the_params.permit( :public_name, :first_name, :last_name, :public_avatar,
                       :address, :address2, :city, :state, :zipcode, :country_id,
                       :userless_registration, :address_required, :email)
  end
end

#user_profile_paramsObject




19
20
21
22
23
24
25
26
# File 'app/models/dm_core/permitted_params.rb', line 19

def 
  if can? :manage, :all
    params.require(:user_profile).permit!
  else
    params.require(:user_profile).permit( :public_name, :first_name, :last_name, :public_avatar,
                   :address, :address2, :city, :state, :zipcode, :country_id)
  end
end