-
-
Save katpadi/02b51d512da925c2b7aa to your computer and use it in GitHub Desktop.
SomethingBuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomethingBuilder | |
def initialize(something) | |
@something = something | |
end | |
def build | |
build_something_after_something_else | |
end | |
private | |
def build_something_after_something_else | |
# Update model A | |
# Insert to model B | |
# Insert to model A and B mapping | |
end | |
end | |
class AController < ApplicationController | |
def create | |
# Do the usual stuff here... | |
# Then, use the service! | |
SomethingBuilder.new(@a).build | |
end | |
# Other controller actions here... | |
end | |
class BController < ApplicationController | |
def create | |
# Do the usual stuff here... | |
# Then, use the service! | |
SomethingBuilder.new(@b).build | |
end | |
# Other controller actions here... | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment