#914 ✓resolved
Betelgeuse

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages