Module: Ixtlan::Controllers::DomainsController
- Defined in:
- lib/ixtlan/controllers/domains_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#create ⇒ Object
POST /domains POST /domains.xml.
-
#destroy ⇒ Object
DELETE /domains/1 DELETE /domains/1.xml.
-
#edit ⇒ Object
GET /domains/1/edit.
-
#index ⇒ Object
GET /domains GET /domains.xml.
-
#new ⇒ Object
GET /domains/new GET /domains/new.xml.
-
#show ⇒ Object
GET /domains/1 GET /domains/1.xml.
-
#update ⇒ Object
PUT /domains/1 PUT /domains/1.xml.
Class Method Details
.included(base) ⇒ Object
5 6 7 8 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 5 def self.included(base) base.send(:include, Ixtlan::Controllers::SearchQuery) base.cache_headers :protected end |
Instance Method Details
#create ⇒ Object
POST /domains POST /domains.xml
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 56 def create @domain = DOMAIN.new(params[:domain]) @domain.current_user = current_user respond_to do |format| if @domain.save flash[:notice] = 'Domain was successfully created.' format.html { redirect_to(domain_url(@domain.id)) } format.xml { render :xml => @domain, :status => :created, :location => domain_url(@domain.id) + ".xml" } else format.html { render :action => "new" } format.xml { render :xml => @domain.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /domains/1 DELETE /domains/1.xml
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 92 def destroy @domain = DOMAIN.first_or_get(params[:id]) @domain.destroy if @domain respond_to do |format| flash[:notice] = 'Domain was successfully deleted.' format.html { redirect_to(domains_url) } format.xml { head :ok } end end |
#edit ⇒ Object
GET /domains/1/edit
50 51 52 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 50 def edit @domain = DOMAIN.first_or_get!(params[:id]) end |
#index ⇒ Object
GET /domains GET /domains.xml
18 19 20 21 22 23 24 25 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 18 def index @domains = query(DOMAIN, :name) respond_to do |format| format.html format.xml { render :xml => @domains } end end |
#new ⇒ Object
GET /domains/new GET /domains/new.xml
40 41 42 43 44 45 46 47 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 40 def new @domain = DOMAIN.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @domain } end end |
#show ⇒ Object
GET /domains/1 GET /domains/1.xml
29 30 31 32 33 34 35 36 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 29 def show @domain = DOMAIN.first_or_get!(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @domain } end end |
#update ⇒ Object
PUT /domains/1 PUT /domains/1.xml
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ixtlan/controllers/domains_controller.rb', line 74 def update @domain = DOMAIN.first_or_get!(params[:id]) @domain.current_user = current_user respond_to do |format| if @domain.update(params[:domain]) or not @domain.dirty? flash[:notice] = 'Domain was successfully updated.' format.html { redirect_to(domain_url(@domain.id)) } format.xml { render :xml => @domain } else format.html { render :action => "edit" } format.xml { render :xml => @domain.errors, :status => :unprocessable_entity } end end end |