Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use build ids for build links #53

Merged
merged 4 commits into from
Jan 30, 2015
Merged

Conversation

samselikoff
Copy link
Contributor

No description provided.

@samselikoff samselikoff mentioned this pull request Jan 30, 2015
10 tasks
@samselikoff
Copy link
Contributor Author

Stupid 3.2, hacked together a solution but it's not very clean. Asked a question here: http://stackoverflow.com/questions/28237343/rails-3-update-attributes-not-working-for-related-model-id.

My solution was

def update
  if use_params(:app_update_params)[:live_build_id]
    new_build_id = use_params(:app_update_params)[:live_build_id]
    build = FrontEndBuilds::Build.find new_build_id
    @app.live_build = build
  end

  if @app.update_attributes( use_params(:app_update_params) )

    respond_with_json(
      { app: @app.serialize },
      location: nil
    )
  else
    respond_with_json(
      { errors: @app.errors },
      status: :unprocessable_entity
    )
  end
end

but I want something cleaner, if possible.

samselikoff added a commit that referenced this pull request Jan 30, 2015
@samselikoff samselikoff merged commit fcb15c3 into master Jan 30, 2015
@samselikoff samselikoff deleted the use_build_ids_for_build_links branch January 30, 2015 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant