Class: PolicyManager::UserPortabilityRequestsController
Instance Method Summary
collapse
#admin_user, #allow_admins, #current_user, #doc, #set_language, #user_authenticated?
Instance Method Details
#create ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/policy_manager/user_portability_requests_controller.rb', line 14
def create
respond_to do |format|
if current_user.can_request_portability?
if current_user.portability_requests.create
format.html{
redirect_to user_portability_requests_path, notice: I18n.t("terms_app.user_portability_requests.index.created")
}
format.json{
render json: {notice: I18n.t("terms_app.user_portability_requests.index.created")}
}
end
else
format.html{
redirect_to user_portability_requests_path, notice: I18n.t("terms_app.user_portability_requests.index.has_pending")
}
format.json{
render json: {notice: I18n.t("terms_app.user_portability_requests.index.has_pending")}, status: 422
}
end
end
end
|
#index ⇒ Object
6
7
8
9
10
11
12
|
# File 'app/controllers/policy_manager/user_portability_requests_controller.rb', line 6
def index
@user_portability_requests = current_user.portability_requests
.order(created_at: :desc)
.paginate(
:page => params[:page],
:per_page => 10)
end
|