Skip to content

Instantly share code, notes, and snippets.

@katpadi

katpadi/gist:02b51d512da925c2b7aa Secret

Last active Aug 29, 2015
Embed
What would you like to do?
SomethingBuilder
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