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

Fix warnings #26

Closed
stas opened this issue Aug 24, 2012 · 6 comments
Closed

Fix warnings #26

stas opened this issue Aug 24, 2012 · 6 comments

Comments

@stas
Copy link
Contributor

stas commented Aug 24, 2012

Hi, I'm on latest released rails with public_activity from master. I get the following warnings when using/testing public_activity:

...
DEPRECATION WARNING: You're trying to create an attribute `recipient_type'. Writing arbitrary attributes on a model is deprecated. Please just use `attr_writer` etc. (called from create_activity at /home/stas/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/public_activity-911c4190580e/lib/public_activity/common.rb:84)
...

Since v0.4.0 is not released, thought you can take a look.
Thanks in advance.

@farnoy
Copy link
Contributor

farnoy commented Aug 25, 2012

Hi, which version of rails are you using?

@stas
Copy link
Contributor Author

stas commented Aug 25, 2012

As for now latest rails is v3.2.8 which I am using.
Also there's no backtrace, it's just a warning.

I might be wrong, but this happens with tracked models, in my case, I hooked to :create event.

@farnoy
Copy link
Contributor

farnoy commented Aug 25, 2012

Are there any more deprecation warnings, like owner_type, trackable_type?

@stas
Copy link
Contributor Author

stas commented Aug 25, 2012

Just recipient_id and recipient_type:

.DEPRECATION WARNING: You're trying to create an attribute `recipient_id'. Writing arbitrary attributes on a model is deprecated. Please just use `attr_writer` etc. (called from create_activity at /home/stas/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/public_activity-911c4190580e/lib/public_activity/common.rb:84)
DEPRECATION WARNING: You're trying to create an attribute `recipient_type'. Writing arbitrary attributes on a model is deprecated. Please just use `attr_writer` etc. (called from create_activity at /home/stas/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/public_activity-911c4190580e/lib/public_activity/common.rb:84)

I believe if I skip any of the activity attributes like owner or etc. it will be present for those too.

@farnoy
Copy link
Contributor

farnoy commented Aug 25, 2012

What you mean is that the warnings appear on attributes that you didn't assign? Could you try assigning none then, to see if warnings for owner and trackable appear too?

If you're upgrading from 0.3.x, did you execute rails generate public_activity:migration_upgrade?

@stas
Copy link
Contributor Author

stas commented Aug 25, 2012

Yep that solved the issue.
Thanks.

@stas stas closed this as completed Aug 25, 2012
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

No branches or pull requests

2 participants