bump.. anyone have thoughts here? Where would object's << be used by
can_view?  What would be different between console and web request?

On Nov 6, 11:13 pm, Peter Ehrlich <[email protected]> wrote:
> Hello!
>
> So I have a model with these lines:
>     belongs_to :item, :class_name => 'ItemSupplier'
>
>     has_one :supplier, :through => :item
> And I have called field list on that.  It gives me this pleasant
> error:
>
> "undefined method `<<' for #<Supplier:0x1068c00a8>"
>
> The extracted source points to a different block of code. Here's the
> top of the trace:
>
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/
> activerecord-2.3.8/lib/active_record/attribute_methods.rb:264:in
> `method_missing_without_find_for'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/hobo-1.0.1/lib/
> hobo/find_for.rb:48:in `method_missing'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/
> activerecord-2.3.8/lib/active_record/associations/
> association_collection.rb:414:in `add_record_to_target_with_callbacks'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/
> activerecord-2.3.8/lib/active_record/associations/
> association_collection.rb:438:in `build_record'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/
> activerecord-2.3.8/lib/active_record/associations/
> association_collection.rb:102:in `new'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/hobo-1.0.1/lib/
> active_record/association_collection.rb:14:in `new_candidate'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/hobo-1.0.1/lib/
> hobo/permissions/associations.rb:68:in `viewable_by?'
> /Users/peter/.rvm/gems/ruby-1.8.7-p...@rails238b/gems/hobo-1.0.1/lib/
> hobo/hobo_helper.rb:326:in `can_view?'
> app/views/taglibs/application.dryml:96:in `card__for_order_items'
> app/views/taglibs/application.dryml:96:in `select'
>
> I modified the source for can_view?, and threw in these lines, to
> double check:
>       logger.warn "Object: #{object}, object's class: #{object.class}"
>       logger.warn "Field: #{field}, field's class: #{field.class}"
>
> Which gives:
>      Object: carpeting, object's class: OrderItems
>      Field: supplier, field's class: String
>
> Now, the annoying bit is that when I try to run it in the console, it
> works.  But then, I don't know alot about the internals of the
> situation:
> ruby-1.8.7-p302 > inclue Hobo::HoboHelper> args = [OrderItems.find(10), 
> "supplier"]
>
>  => [#<OrderItems id: 10, quantity: 1, sale_price: #<BigDecimal:
> 1033852a8,'0.11E2',9(18)>, created_at: "2010-11-07 01:30:49",
> updated_at: "2010-11-07 01:30:49", order_id: 15, item_id: 3>,
> "supplier"]> can_view?(args)
>
>  => true
>
> Thanks,
> --Peter

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to