Class: AuthorInputFormControllerCreate
- Inherits:
-
Object
- Object
- AuthorInputFormControllerCreate
- Defined in:
- lib/author/controllers/author_input_form_controller_create.rb
Instance Method Summary collapse
-
#initialize(parent_controller) ⇒ AuthorInputFormControllerCreate
constructor
A new instance of AuthorInputFormControllerCreate.
- #on_view_created ⇒ Object
- #process_fields(fields) ⇒ Object
- #set_view(view) ⇒ Object
Constructor Details
#initialize(parent_controller) ⇒ AuthorInputFormControllerCreate
Returns a new instance of AuthorInputFormControllerCreate.
6 7 8 9 |
# File 'lib/author/controllers/author_input_form_controller_create.rb', line 6 def initialize(parent_controller) @parent_controller = parent_controller @author_rep = AuthorDBDataSource.new end |
Instance Method Details
#on_view_created ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/author/controllers/author_input_form_controller_create.rb', line 15 def on_view_created # begin # @student_rep = StudentRepository.new(DBSourceAdapter.new) # rescue Mysql2::Error::ConnectionError # on_db_conn_error # end end |
#process_fields(fields) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/author/controllers/author_input_form_controller_create.rb', line 23 def process_fields(fields) begin puts fields item = Author.new(-1, *fields.values) puts item item = @author_rep.add(item) @parent_controller.state_notifier.add(item) @view.close rescue ArgumentError => e api = Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I') api.call(0, e., 'Error', 0) end end |
#set_view(view) ⇒ Object
11 12 13 |
# File 'lib/author/controllers/author_input_form_controller_create.rb', line 11 def set_view(view) @view = view end |