Skip to content

Commit 6a5296c

Browse files
authored
Merge pull request #9 from substancelab/action
Add an Action to Companies
2 parents bf73f1b + f325103 commit 6a5296c

3 files changed

Lines changed: 29 additions & 4 deletions

File tree

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
GIT
22
remote: https://github.com/substancelab/uchi.git
3-
revision: 31735d16f36966ecbb6ea5b7ab5e61f517f48fa1
3+
revision: e01fe9a2ca72a38402e7d0378a0c8b63df6fbf85
44
specs:
5-
uchi (0.1.5)
5+
uchi (0.1.6)
66
rails (>= 7.2)
77
turbo-rails
88
view_component (>= 4.0)
@@ -113,7 +113,7 @@ GEM
113113
concurrent-ruby (1.3.5)
114114
connection_pool (3.0.2)
115115
crass (1.0.6)
116-
date (3.5.0)
116+
date (3.5.1)
117117
debug (1.11.0)
118118
irb (~> 1.10)
119119
reline (>= 0.3.8)
@@ -230,7 +230,7 @@ GEM
230230
actionpack (>= 7.0.0)
231231
activesupport (>= 7.0.0)
232232
rack
233-
psych (5.2.6)
233+
psych (5.3.0)
234234
date
235235
stringio
236236
public_suffix (7.0.0)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Uchi
2+
module Actions
3+
module Companies
4+
class GenerateTagline < Uchi::Action
5+
def name
6+
"Set a new tagline"
7+
end
8+
9+
def perform(records, inputs = {})
10+
records.each do |company|
11+
company.update(tagline: Faker::Company.catch_phrase)
12+
end
13+
14+
ActionResponse.success("Tagline has been changed")
15+
end
16+
end
17+
end
18+
end
19+
end

app/uchi/repositories/company.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
module Uchi
44
module Repositories
55
class Company < Repository
6+
def actions
7+
[
8+
Uchi::Actions::Companies::GenerateTagline.new
9+
]
10+
end
11+
612
def fields
713
[
814
Field::Id.new(:id),

0 commit comments

Comments
 (0)