Created
January 14, 2016 16:04
-
-
Save chewmanfoo/1ff8c84100addd838ff1 to your computer and use it in GitHub Desktop.
why doesn't app.versions get created?
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 DeployableApplication < ActiveRecord::Base | |
belongs_to :git_repo | |
belongs_to :rpm_repo | |
has_many :versions | |
end |
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 GitRpmBuilderEngine | |
require 'tmpdir' | |
def initialize(_deployable_application_id, _major=false, _minor=false, _micro=true) | |
@app = DeployableApplication.find(_deployable_application_id) | |
@git_repo = @app.git_repo | |
@rpm_repo = @app.rpm_repo | |
@major = _major | |
@minor = _minor | |
@micro = _micro | |
@app_name = @git_repo.name | |
@version = get_version | |
# does this DeployableApplication have a Version? (first import) | |
unless @app.versions.empty? | |
p "got to @app.versions builder" | |
@app.versions.create(build_version: @version) | |
end |
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 Version < ActiveRecord::Base | |
belongs_to :deployable_application | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment