has_many :accessible => true broken in Hobo 1.3
Reported by Betelgeuse | February 8th, 2011 @ 01:00 PM | in Hobo 1.3 (Rails 3)
Processing by FoobarsController#create as HTML
Parameters: {"page_path"=>"/foobars/new", "foobar"=>{"name"=>"asdas", "users"=>["", "@1"]}, "authenticity_token"=>"+0BRJtY0kDN4lotnFbmvUs5Jzv+y1xKJKnZvK2YzF7c="}
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<=>):
activerecord (3.0.3) lib/active_record/base.rb:1512:in `sort'
activerecord (3.0.3) lib/active_record/base.rb:1512:in `attribute_names'
activerecord (3.0.3) lib/active_record/base.rb:1569:in `attributes'
activerecord (3.0.3) lib/active_record/attribute_methods.rb:57:in `attribute_method?'
activemodel (3.0.3) lib/active_model/attribute_methods.rb:394:in `match_attribute_method?'
activemodel (3.0.3) lib/active_model/attribute_methods.rb:393:in `each'
activemodel (3.0.3) lib/active_model/attribute_methods.rb:393:in `match_attribute_method?'
activemodel (3.0.3) lib/active_model/attribute_methods.rb:378:in `respond_to?'
activerecord (3.0.3) lib/active_record/attribute_methods.rb:52:in `respond_to?'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:296:in `flatten'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:296:in `rollback_transaction_records'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:177:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:204:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
activerecord (3.0.3) lib/active_record/transactions.rb:236:in `save'
hobo (1.3.0.pre26) lib/hobo/model/permissions.rb:174:in `user_save'
This was tested with a freshly created Hobo app
class Foobar < ActiveRecord::Base
hobo_model
fields do
name :string
end
has_many :foobars_users
has_many :users, :through => :foobars_users, :accessible => true
def create_permitted?(field = nil)
true
end
alias :update_permitted? :create_permitted?
alias :destroy_permitted? :create_permitted?
alias :view_permitted? :create_permitted?
end
Comments and changes to this ticket
-
Domizio Demichelis February 8th, 2011 @ 02:07 PM
- State changed from new to investigating
You should probably search elsewhere in your application, or please tell me how to reproduce it, because it doesn't look broken here!
-
Betelgeuse February 8th, 2011 @ 02:11 PM
I pushed the test application to github at https://github.com/betelgeuse/hobo13-accessible
-
Domizio Demichelis February 8th, 2011 @ 02:45 PM
- State changed from investigating to new
- Assigned user cleared.
Thank you, it seems a problem related to the pg gem.
I changed it with sqlite3-ruby and it works. Since I am not a Postgree expert (I don't even have it installed), somebody else should dig into it. If you can do it, that would be perfect! Thank you.
-
Domizio Demichelis February 8th, 2011 @ 02:46 PM
- Tag changed from associations, defect, rails3 to associations, defect, postgresql, rails3
-
Betelgeuse February 10th, 2011 @ 12:00 PM
Have you reported this issue to the rails tracker? I would be interested to follow up there.
-
Domizio Demichelis February 10th, 2011 @ 01:03 PM
Nice report! We could probably mark this ticket as resolved by rails 3.0.4
:-) -
Domizio Demichelis February 10th, 2011 @ 01:39 PM
- State changed from new to resolved
- Milestone set to Hobo 1.3 (Rails 3)
- Assigned user set to Domizio Demichelis
- Milestone order changed from 197937 to 0
resolved by rails 3.0.4
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป