Displaying 7 results from an estimated 7 matches for "errors_for".
2007 Jul 15
0
errors_for
Been playing with merb.
One of the helpers I liked in rails was on form validations. Found
this was real easy to port over, so I thought I''d share.
It doesn''t highlight the field with the error, but it gives that same
nice little div on top.
Say I had an articles controller
def create
@article = Article.new(params[:article])
@article.save!
redirect
2006 Aug 01
6
warning and errors
...already initialized constant P
(eval):101: warning: already initialized constant H
(eval):132: warning: method redefined; discarding old method_missing
(eval):135: warning: discarding old u
(eval):208: warning: method redefined; discarding old R
(eval):233: warning: method redefined; discarding old errors_for
(eval):241: warning: method redefined; discarding old /
(eval):268: warning: method redefined; discarding old URL
(eval):312: warning: already initialized constant Z
(eval):339: warning: method redefined; discarding old method_missing
(eval):359: warning: method redefined; discarding old redirect
(...
2011 May 20
3
How to handle non model data in form?
Hey,
I got a form which looks like this:
- form_for(@article, :html => {:multipart => true}, :url =>
articles_path) do |f|
= errors_for(@article)
.field
= f.label :text
%br
= f.text_field :text
.field
= f.label :author_id
%br
= f.text_field :author_id
.actions
= f.submit
But since I don''t want anyone to type in an author id I changed it to:
.field
= f.label :author_name
%br...
2007 Jul 07
0
[patch] trunk markaby fix
...------- next part --------------
Index: camping.rb
===================================================================
--- camping.rb (revision 194)
+++ camping.rb (working copy)
@@ -7,7 +7,7 @@
c=self/c;c="//"+ at env.HTTP_HOST+c if c[/^\//];URI(c)end;def/p;p[/^\//]?@root+p :
p end;def errors_for o;ul.errors{o.errors.each_full{|x|li x}}if o.errors.any?end
end;module Base;include Helpers;attr_accessor:input,:cookies,:env,:headers,:body,
-:status,:root;def method_missing*a,&b;a.shift if a[0]==:render;m=Mab.new {},self
+:status,:root;def method_missing*a,&b;a.shift if a[0]==:render;m=...
2006 Mar 10
1
Validate fields and display errors from two models?
Hi,
I have here a problem I''ve been working at for a little while but I
can''t seem to get the error messages to appear correctly.
My form looks something like this for "ModelA":
[errors_for "modelA"]
[form for "modelA"]
[text "modelA" "fieldname1"]
[text "modelB" "fieldname2"]
[submit]
[/form]
The reason for this is I can create many modelB''s for each modelA but
when I create modelA I want it to create the first mo...
2008 Jun 10
2
validates_associated doesn't work on update (and i've tried :on => :update)
...notice] = ''Story posted!''
redirect_to :action => ''index''
end
rescue ActiveRecord::RecordInvalid => e
render :action => "new"
end
...
Now, this works fine, I see the correct error on the stories form
(from errors_for :story) if I put an invalid tag in.
Here''s the update method:
def update
@story = current_user.stories.find(params[:story][:id])
@story.attributes = params[:story]
if request.post?
begin
Story.transaction do
@story.write_tags
@story.save!...
2007 Sep 23
12
Next camping release
...e that camping.rb should be lower than 4k. He also told me
that he wanted to remove the ActiveSupport and Markaby dependencies.
I am writing here to get the users input so that I don''t do any
mistake. So far, my plans are to :
- solve all remaining bugs in the tracker
- remove the unused #errors_for method. Please give some input if you do !
- add some unit-tests.
This will result in a short-term release with not too much changes,
used for code stabilization.
When this is done, I will embark on 2.0 for bigger changes like
Markaby and AR removal.
Cheers,
zimbatm