Class: Dscf::Core::BusinessesController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Dscf::Core::BusinessesController
- Includes:
- Common, ReviewableController
- Defined in:
- app/controllers/dscf/core/businesses_controller.rb
Instance Method Summary collapse
Methods included from JsonResponse
#render_error, #render_success, #serialize
Methods included from Common
Methods included from Filterable
Methods included from Pagination
#default_per_page, #order_by, #order_direction, #page_no, #paginate, #paginate_offset, #pagination_links, #per_page
Methods included from TokenAuthenticatable
#require_valid_refresh_token, #validate_device_consistency, #validate_token_expiry
Methods included from Authenticatable
#authenticate_user, #authenticate_user!, #current_user, #refresh_token, #sign_in, #sign_out
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/dscf/core/businesses_controller.rb', line 7 def create super do business = @clazz.new(model_params) business.user = current_user if business.save && params[:business][:business_license].present? document = business.documents.create!( document_type: :business_license ) document.files.attach(params[:business][:business_license]) document.save! end business end end |
#my_business ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/dscf/core/businesses_controller.rb', line 35 def my_business index do current_user.businesses end end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/dscf/core/businesses_controller.rb', line 24 def update unless @obj.editable? return render_error( message_key: "business.errors.update_submitted", status: :unprocessable_entity ) end super end |