#803 open
Betelgeuse

Hobo generates field entries for fields of other STI subclasses to forms.dryml

Reported by Betelgeuse | September 27th, 2010 @ 06:53 AM | in Hobo 1.1

The generator code:

betelgeuse@mac ~/checkouts/hobo $ head -n5 hobo/dryml_generators/rapid/forms.dryml.erb 
<% each_controller do -%>
<%
form_fields = standard_fields :belongs_to, :has_many

cancel_to_show_page  = linkable?(:show)

standard_fields eventually calls down to attr_order for the model class. It seems to include all fields in the database. I think it should instead just have the fields for this particular inheritance chain. This would also solve the problem that currently the order depends on the order in which the child classes are loaded which is not that nice.

Comments and changes to this ticket

  • Bryan Larsen

    Bryan Larsen November 15th, 2010 @ 09:41 PM

    • State changed from “new” to “open”
    • Milestone set to Hobo 1.1
    • Milestone order changed from “197894” to “0”

    This is definitely not going to be an easy one. Hobo gets the field list from the database, that's a fundamental part of how it operates. The "fields" declaration in a model is purely optional. Even if we did ask HoboFields and fell back to the database, I bet you HoboFields stores the list in the Class, and I bet you that list ends up getting shared between all the classes. I'm going to leave this in the "1.1" milestone for now, but I wouldn't be surprised if it gets bumped....

  • Betelgeuse

    Betelgeuse November 16th, 2010 @ 07:37 AM

    The current field_specs does expose the class where it was declared:

    >> User.field_specs['child_attribute'].model
    => Child
    

    I have used this feature to work around this problem by making view_permitted? check field_checks in STI child classes.

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 ยป

Pages