Skip to content

Instantly share code, notes, and snippets.

@chewmanfoo
Created January 14, 2016 16:04
Show Gist options
  • Save chewmanfoo/1ff8c84100addd838ff1 to your computer and use it in GitHub Desktop.
Save chewmanfoo/1ff8c84100addd838ff1 to your computer and use it in GitHub Desktop.
why doesn't app.versions get created?
class DeployableApplication < ActiveRecord::Base
belongs_to :git_repo
belongs_to :rpm_repo
has_many :versions
end
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
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