root/trunk/app/controllers/application.rb @ 104

Revision 104, 1.0 KB (checked in by mauriciobomfim, 4 years ago)

commit de teste

Line 
1require 'controller_helper'
2require 'crud_controller'
3 
4# The filters added to this controller will be run for all controllers in the application.
5# Likewise will all the methods added be available for all controllers.
6class ApplicationController < ActionController::Base
7  observer :model_observer
8  prepend_before_filter :verify_repo, :except => [:select, :set]
9  before_filter :set_return_to
10        before_filter :set_charset
11         
12  include ReturnTo
13
14  def goto_application
15    do_return_to(:controller => "navigation")
16  end
17
18  def verify_repo
19    session['repo'] ||= SemanticRecord::Base::repository['repository']
20    if session['repo'].nil? or session['repo'].blank?
21      redirect_to :controller => 'repository', :action => 'select' and return false
22    else
23      set_repo
24    end
25  end
26
27  def set_repo
28    if session['repo'] != SemanticRecord::Base::repository['repository']
29      SemanticRecord::Base::change_repository(session['repo'])
30    end
31  end   
32
33  def set_charset
34    @headers["Content-Type"] = "text/html; charset=utf-8"
35  end
36end
Note: See TracBrowser for help on using the browser.