-
Notifications
You must be signed in to change notification settings - Fork 154
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
ProjectResource assign_resources raises NoMethodError (undefined method `try') #251
Comments
Also, I'm not sure if this is related, but if I use the actual urn string of the db cluster, I get an API error: db_cluster = client.databases.find_cluster(id: "cluster_id")
client.projects.assign_resources([db_cluster.urn], id: project.id)
# => DropletKit::Error (400: {"id":"invalid_argument","message":"resource objects must have an urn in the following format: do:resource_type:resource_id"})
db_cluster.urn
# => "do:database_cluster:c023fcd4-xxxx-xxxx-xxxx-90a776d3e537" UPDATE: It looks like this problem is only happening with db clusters. I can assign a droplet to a project without trouble: droplet = client.droplets.find(id: "xxxxx")
client.projects.assign_resources([droplet.urn], id: project.id)
# => [<DropletKit::ProjectAssignment {:@urn=>"do:droplet:xxxxx", :@assigned_at=>"2020-08-02T00:11:01Z", :@links=><DropletKit::Links {:@myself=>"https://api.digitalocean.com/v2/droplets/xxxxx", :@first=>nil, :@next=>nil, :@prev=>nil, :@last=>nil}>}>] |
fwitzke
pushed a commit
to fwitzke/droplet_kit
that referenced
this issue
Apr 17, 2021
- It also adds tests to `assign_reources` method, which was lacking. - Ths fixes digitalocean#251 (digitalocean#251)
fwitzke
pushed a commit
to fwitzke/droplet_kit
that referenced
this issue
Apr 17, 2021
- It also adds tests to `assign_resources` method, which was lacking. - This fixes digitalocean#251 (digitalocean#251)
andrewsomething
pushed a commit
that referenced
this issue
Apr 19, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using plain ruby (not Ruby on Rails), if you assign a resource to a project, it raises NoMethodError. This happens only if the resource is an object (not urn string). Example:
This is because
try
is a method introduced by Ruby on Rails, and it's not available in plain ruby.droplet_kit/lib/droplet_kit/resources/project_resource.rb
Line 51 in b6c0970
To play well with plain ruby, the line above could be replaced with this:
Using
droplet_kit-3.8.0
The text was updated successfully, but these errors were encountered: