Class: ArDiagram::ArDiagramController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ArDiagram::ArDiagramController
- Defined in:
- app/controllers/ar_diagram/ar_diagram_controller.rb
Instance Method Summary collapse
- #add_table ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#add_table ⇒ Object
59 60 61 62 |
# File 'app/controllers/ar_diagram/ar_diagram_controller.rb', line 59 def add_table model = params[:model].camelize @table = Table.new({:name => model}) end |
#create ⇒ Object
31 32 33 34 35 36 |
# File 'app/controllers/ar_diagram/ar_diagram_controller.rb', line 31 def create @view = View.new(params[:view]) @view.zoom = 1 @view.save redirect_to(ar_diagram_path(@view.id)) end |
#destroy ⇒ Object
53 54 55 56 57 |
# File 'app/controllers/ar_diagram/ar_diagram_controller.rb', line 53 def destroy @view = View.find(params[:id]) @view.destroy redirect_to ar_diagram_index_path end |
#index ⇒ Object
15 16 17 |
# File 'app/controllers/ar_diagram/ar_diagram_controller.rb', line 15 def index @views = View.all end |
#show ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/ar_diagram/ar_diagram_controller.rb', line 19 def show @view = View.find(params[:id]) @views = View.all @tables = available_tables @db_module if params[:print] render "show", :layout => "ar_diagram/ar_diagram_print" else render end end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/ar_diagram/ar_diagram_controller.rb', line 38 def update @view = View.find(params[:id]) @view.tables.update_all(:archive => true) params[:tables].each do |name, table| t = @view.tables.find_or_initialize_by_name(model_name(name)) t.archive = false t.position_x = table["x"] t.position_y = table["y"] t.save end @view.zoom = params[:zoom] @view.save @success = true end |