#651 ✓invalid
Kieran P

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

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