Class: DomainsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DomainsController
- Includes:
- DomainAuthorization
- Defined in:
- app/controllers/domains_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #email ⇒ Object
- #index ⇒ Object
- #links ⇒ Object
- #provision ⇒ Object
- #request_domain ⇒ Object
- #settings ⇒ Object
- #show ⇒ Object
- #transfer ⇒ Object
Methods included from DomainAuthorization
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/domains_controller.rb', line 41 def create @domain = Domain.new(host: params[:host], user_users_id: current_user.id) if @domain.save redirect_to domain_path(@domain) else render json: @domain.errors, status: 418 end end |
#destroy ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/domains_controller.rb', line 20 def destroy @domain = Domain.find_by(host: params["host"]) if @domain.destroy redirect_to root_url else render json: @domain.errors, status: 418 end end |
#email ⇒ Object
29 30 31 |
# File 'app/controllers/domains_controller.rb', line 29 def email @domain = Domain.find_by(host: params["host"]) end |
#index ⇒ Object
15 16 17 18 |
# File 'app/controllers/domains_controller.rb', line 15 def index @domains = Domain.where(user_users_id: current_user.id) @user = current_user end |
#links ⇒ Object
33 34 35 |
# File 'app/controllers/domains_controller.rb', line 33 def links @domain = Domain.find_by(host: params["host"]) end |
#provision ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/domains_controller.rb', line 51 def provision @domain = Domain.new(host: params[:host], plan: params[:plan], provisional: true, user_users_id: current_user.id) if @domain.save redirect_to root_path else flash.notice = @domain.errors.[0] redirect_back_or_to request_domains_path end end |
#request_domain ⇒ Object
82 83 |
# File 'app/controllers/domains_controller.rb', line 82 def request_domain end |
#settings ⇒ Object
37 38 39 |
# File 'app/controllers/domains_controller.rb', line 37 def settings @domain = Domain.find_by(host: params["host"]) end |
#show ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/controllers/domains_controller.rb', line 68 def show @domain = current_domain @records = [] all_records = Record.where_host(@domain.host) if all_records.length > 3 @records[0] = all_records[0] @records[1] = all_records[1] @records[2] = all_records[2] else @records = all_records end end |
#transfer ⇒ Object
61 62 63 64 65 66 |
# File 'app/controllers/domains_controller.rb', line 61 def transfer @domain = Domain.find_by(host: params["host"]) @domain.user_users_id = params["new_user_id"] @domain.save! DomainMailer.with(email: User::User.find_by(id: @domain.user_users_id).email, domain: @domain.host).domain_created_email.deliver_later end |