Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Commit aaf9926

Browse files
committed
Add service and form object base class
1 parent cce213a commit aaf9926

File tree

4 files changed

+36
-9
lines changed

4 files changed

+36
-9
lines changed

app/forms/application_form.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class ApplicationForm
2+
include ActiveModel::Model
3+
4+
class << self
5+
def i18n_scope
6+
:form
7+
end
8+
end
9+
10+
# Inherited class should define 2 methods like below:
11+
#
12+
# def initialize(params = {})
13+
# @model = Model.new
14+
# super(params)
15+
#
16+
# # other actions here...
17+
# end
18+
19+
# def submit
20+
# return false if invalid?
21+
# # other actions here...
22+
# end
23+
end

app/forms/base_form.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/services/application_service.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class ApplicationService
2+
def self.call(*args, &block)
3+
new(*args, &block).call
4+
end
5+
6+
# Inherited class should define 2 methods:
7+
#
8+
# def initialize(*args)
9+
# end
10+
11+
# def call
12+
# end
13+
end
File renamed without changes.

0 commit comments

Comments
 (0)