Extending a form is not skip fields I define it to skip
Reported by Kieran P | March 2nd, 2010 @ 02:05 AM
I have a hobo_model_resource called Job and one called Hour.
class Hour < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
staff_id :integer, :required
job_id :integer, :required
name :string, :required, :unique
timestamps
end
belongs_to :staff, :class_name => "User", :foreign_key => :id
belongs_to :job
before_create :assign_staff_to_acting_user
private
def assign_staff_to_acting_user
self.staff = acting_user
end
end
Now, since you can only create an hour through a job, and the staff is the acting user the job, I don't need to display either the staff or the job dropdowns. So I put this in application.dryml
<extend tag="form" for="Hour">
<old-form merge>
<field-list: skip="job, staff"/>
</old-form>
</extend>
Sadly, the staff dropdown is not hidden (the job one is though).
Comments and changes to this ticket
-
Matt Jones April 26th, 2010 @ 02:22 AM
If it's not too much trouble, can you try this again without the
:foreign_key => :id
bug on the:staff
association? I suspect you've hit a variant of #572, but I'm not sure. -
Matt Jones September 14th, 2011 @ 10:29 PM
- State changed from new to invalid
- Milestone order changed from 0 to 0
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 ยป