Comments (2)
Hey,
Sorry for the delay...
The problem is that ActiveResource doesn't mark the object as persisted after creation and that's because of the empty response body we receive from Basecamp:
> message = Basecamp::Message.new(:project_id => "1234", :title => "Title", :body => "Body")
> response = Basecamp::Message.connection.response
> response.code
=> "201"
> response['Location']
=> "/posts/69524264.xml"
> response.body
=> " "
ActiveResource gets the id from the location: http://apidock.com/rails/v2.3.8/ActiveResource/Base/id_from_response but can't load the attributes from the response: http://apidock.com/rails/v2.3.8/ActiveResource/Base/load_attributes_from_response so it doesn't mark the object as persisted and the to_param
method returns nil.
So you'll have to find the message after creation using the object id:
> message = Basecamp::Message.new(:project_id => "1234", :title => "Title", :body => "Body")
> message = Basecamp::Message.find(message.id)
> message.reload
=> #<Basecamp::Message:0x00000102359348 ...
Hope this helps,
Anibal
from basecamp-wrapper.
Thanks for the response and explanation! I really do appreciate it!
from basecamp-wrapper.
Related Issues (20)
- Changing default return format HOT 7
- NoMethodError: undefined method `collect!' for #<Hash:0x00000100b74c50> HOT 1
- Launchpad Data HOT 1
- Cannot retrieve time entries HOT 2
- Milestone#list not functioning HOT 3
- 404 Errors when creating messages HOT 6
- unable to save/update time_entries HOT 2
- Response Headers HOT 2
- 'Ignored' params in find call HOT 2
- comments pagination is not supported HOT 4
- Create project with template HOT 2
- Basecamp.record(s) methods HOT 1
- Not thread-safe HOT 1
- Todo Item ID missing from Time Entries HOT 1
- Accessing the todo_list from the todo_item HOT 3
- need help for method missing - todo_list.project_id HOT 1
- Using this with rails 2.3.5 HOT 1
- New Version Changed Things. HOT 2
- Doesn't handle 301 redirects HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basecamp-wrapper.