[PATCH] [SPEC] form_for bound to non-AR or non-DM objects
Reported by Matthijs Langenberg | August 28th, 2008 @ 04:29 PM | in 1.0
Currently, the following fails:
class Post
attr_reader :body
end
form_for(Post.new) do
text_area :body
end
This is because Post#errors and Post#new_record? do not exists.
In my opinion, the bound helpers should be usable with DM, ActiveRecord, but also other kinds of objects. Which may or may not respond to either 'errors' or 'new_record?'.
Comments and changes to this ticket
-
Matthijs Langenberg August 28th, 2008 @ 04:31 PM
By the way, I think the specs can be greatly refactored. The only difference is the lambda being called, which is of course very portable.
-
Matthijs Langenberg August 29th, 2008 @ 10:33 AM
Looks like I misunderstood something. I should be able to do:
class Assets < Application self._form_class = Merb::Helpers::Form::Builder::ResourcefulForm def new .... end endIn my opinion this isn't really that elegant, am I still missing something, is there another way for setting the builder?
Correctly if I'm wrong, but even the ResourcefulForm still calls #new_record? on the object.
-
Michael Klishin (antares) September 6th, 2008 @ 02:14 AM
- → Milestone changed from to 1.0
- → State changed from new to open
- → Assigned user changed from to GMFlash
-

GMFlash September 6th, 2008 @ 06:21 AM
As a side effect of this commit the new_record? bug has been fixed. For the issue with .errors you should use the ResourcefulForm builder instead of ResourcefulFormWithErrors.
-
Matthijs Langenberg September 6th, 2008 @ 09:55 AM
Alright, so that will render this ticket invalid. Can someone set the ticket state to invalid?
Op 6 sep 2008 om 05:21 heeft Lighthouse support@lighthouseapp.com het volgende geschreven:\
-

GMFlash September 6th, 2008 @ 10:07 AM
- → State changed from open to invalid
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
