Comments (13)
Hi! I will take a look at this today. Thank you for reporting!
from public_activity.
Tested this on the latest Rails 3.2.9 and there is no deprecation warning. Please update the Rails gem and report again.
from public_activity.
I'm using Rails 3.2.9 and public_activity 0.5.4 and I'm still getting the issue. I'm not too sure whether it is public_activity causing the problem. I've updated most of the gems and upgraded the public_activity database.
from public_activity.
Could you post the exact warning you get? I can only think of this line, but I'm not sure.
from public_activity.
Sure, the message I'm getting is:
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 logged_in at /Users/deanperry/Projects/project/spec/spec_helper.rb:45)
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 logged_in at /Users/deanperry/Projects/project/spec/spec_helper.rb:45)
re-renders the :new template
It only seems to do it in the test environment though.
RAILS_ENV=test rails c
Loading test environment (Rails 3.2.9)
>> Customer.create! name: "hello again"
(0.2ms) BEGIN
Customer Exists (0.4ms) SELECT 1 AS one FROM `customers` WHERE `customers`.`uuid` = 'db0ba553-46d4-46f6-8fb7-158046ba89d8' ORDER BY id DESC LIMIT 1
SQL (0.3ms) INSERT INTO `customers` (`address1`, `address2`, `address3`, `business_name`, `created_at`, `email`, `mobile`, `name`, `phone`, `postcode`, `updated_at`, `uuid`, `where_find_us`) VALUES (NULL, NULL, NULL, NULL, '2012-12-29 11:34:07', NULL, NULL, 'hello again', NULL, NULL, '2012-12-29 11:34:07', 'db0ba553-46d4-46f6-8fb7-158046ba89d8', NULL)
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 irb_binding at (irb):1)
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 irb_binding at (irb):1)
SQL (0.3ms) INSERT INTO `activities` (`created_at`, `key`, `owner_id`, `owner_type`, `parameters`, `trackable_id`, `trackable_type`, `updated_at`) VALUES ('2012-12-29 11:34:08', 'customer.create', NULL, NULL, '--- {}\n', 7, 'Customer', '2012-12-29 11:34:08')
(0.4ms) UPDATE `activities` SET `updated_at` = '2012-12-29 11:34:08', `parameters` = '--- {}\n' WHERE `activities`.`id` = 52
(0.5ms) COMMIT
=> #<Customer id: 7, name: "hello again", business_name: nil, address1: nil, address2: nil, address3: nil, postcode: nil, phone: nil, mobile: nil, email: nil, uuid: "db0ba553-46d4-46f6-8fb7-158046ba89d8", created_at: "2012-12-29 11:34:07", updated_at: "2012-12-29 11:34:07", where_find_us: nil>
In the development console it works ok:
rails c
Loading development environment (Rails 3.2.9)
>> Customer.create! name: "hello again"
(0.2ms) BEGIN
Customer Exists (0.4ms) SELECT 1 AS one FROM `customers` WHERE `customers`.`uuid` = '07f6ede7-7864-42b4-9593-fbde11e09738' ORDER BY id DESC LIMIT 1
SQL (0.3ms) INSERT INTO `customers` (`address1`, `address2`, `address3`, `business_name`, `created_at`, `email`, `mobile`, `name`, `phone`, `postcode`, `updated_at`, `uuid`, `where_find_us`) VALUES (NULL, NULL, NULL, NULL, '2012-12-29 11:34:55', NULL, NULL, 'hello again', NULL, NULL, '2012-12-29 11:34:55', '07f6ede7-7864-42b4-9593-fbde11e09738', NULL)
SQL (0.6ms) INSERT INTO `activities` (`created_at`, `key`, `owner_id`, `owner_type`, `parameters`, `trackable_id`, `trackable_type`, `updated_at`) VALUES ('2012-12-29 11:34:55', 'customer.create', NULL, NULL, '--- {}\n', 1, 'Customer', '2012-12-29 11:34:55')
(0.4ms) UPDATE `activities` SET `updated_at` = '2012-12-29 11:34:55', `parameters` = '--- {}\n' WHERE `activities`.`id` = 3
(0.5ms) COMMIT
=> #<Customer id: 1, name: "hello again", business_name: nil, address1: nil, address2: nil, address3: nil, postcode: nil, phone: nil, mobile: nil, email: nil, uuid: "07f6ede7-7864-42b4-9593-fbde11e09738", created_at: "2012-12-29 11:34:55", updated_at: "2012-12-29 11:34:55", where_find_us: nil>
from public_activity.
And what do you have at /Users/deanperry/Projects/project/spec/spec_helper.rb:45
?
from public_activity.
Line 45 of spec_helper.rb is User.create!(:username => "bob", :password => "password", :name => "Bob")
. It's a method for creating and logging in a user because the whole app is protected.
from public_activity.
Are you sure you've executed the latest migration? This could be caused by a missing columns, which we use as foreign keys.
from public_activity.
I have yep. I've also completely reset the database and all that.
When running the public_activity update it doesn't seem to do much, is this right?
== UpgradeActivities: migrating ==============================================
== UpgradeActivities: migrated (0.0000s) =====================================
from public_activity.
It should. Could you post your schema.rb section for activities table?
from public_activity.
Sure, here it is:
create_table "activities", :force => true do |t|
t.integer "trackable_id"
t.string "trackable_type"
t.integer "owner_id"
t.string "owner_type"
t.string "key"
t.text "parameters"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
I've deleted the db/schema.rb file and reset the database as well.
from public_activity.
You're missing recipient_id and recipient_type. If you're resetting the database anyway, replace the create_activities migration with the one form a newer p_a (one new line).
For some reason, UpgradeActivities makes no changes for you when it should.
from public_activity.
Excellent, I've removed the old create_activities migration and the upgrade_activities and I've copied the code from https://github.com/pokonski/public_activity/blob/master/lib/generators/public_activity/migration/templates/migration.rb and I'm not getting that error any more. Thanks for your help!
from public_activity.
Related Issues (20)
- Gem requires db connection during assets precompile HOT 9
- After setting up public_activity missing render HOT 1
- How to handle activity where parameters is empty? HOT 1
- why public_activity dependency is not resolved by actionpack gem with version 6.0.4 HOT 2
- Random odd failure when PublicActivity.with_tracking used in Rails app with RSpec HOT 1
- Commits for new versions not in Github HOT 2
- Trying to return activity text such as "updated ..." in API HOT 1
- Release notes for 2.0.0 HOT 1
- Issue when tracking is triggered from within a thread HOT 3
- Custom After_Commit callback when activities are created HOT 2
- Callbacks not triggered when used in combination with activerecord-import HOT 2
- DRY Rendering activities using ViewComponent HOT 3
- Psych::DisallowedClass: Tried to load unspecified class: Symbol HOT 5
- Heroku demo site is down HOT 1
- TypeError: no implicit conversion of Symbol into Integer HOT 2
- Was :fallback accidentally left out? HOT 1
- missing keyword: :coder If no default coder is configured, a coder must be provided to `serialize`. rails 7 HOT 10
- ActiveRecord::Base.serialize signature changed when ActiveRecord >= 7.1 HOT 1
- v3 has breaking change (parameters defaults to nil) HOT 2
- Error: Tried to load unspecified class Psych::DisallowedClass of a model HOT 6
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 public_activity.