i am having one comment module and putted the two validation and i have putted or copy the code of the add form of this module to my public module and when user add comment from the public module the customer flag is 1 and validations are not working how i can make it work my comment module create function is this and m using this function for both the module.. def create @comment = Comment.new(params[:comment]) respond_to do |format| if @comment.save flash[:notice] = ''comment was successfully created.'' if(params[:customer]=="1") format.html { redirect_to root_url+params[:menu] +"/"+params[:menu1] } else #format.html{render :text=>params[:customer]} format.html { redirect_to(@comment) } end format.xml { render :xml => @comment, :status => :created, :location => @comment } else if(params[:customer]=="1") format.html { redirect_to root_url+params[:menu] +"/"+params[:menu1] } else format.html { render :action => "new" } end format.xml { render :xml => @comment.errors, :status => :unprocessable_entity } end end end please help ASAP. thanks rahul -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
please help on this is urgent... On May 2, 2:54 pm, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i am having one comment module and putted the two validation and i > have putted or copy the code of the add form of this module to my > public module > > and when user add comment from the public module the customer flag is > 1 > and validations are not working how i can make it work > > my comment module create function is this and m using this function > for both the module.. > > def create > @comment = Comment.new(params[:comment]) > respond_to do |format| > if @comment.save > flash[:notice] = ''comment was successfully created.'' > if(params[:customer]=="1") > > format.html { redirect_to root_url+params[:menu] > +"/"+params[:menu1] } > else > #format.html{render :text=>params[:customer]} > format.html { redirect_to(@comment) } > end > format.xml { render :xml => @comment, :status > => :created, :location => @comment } > else > if(params[:customer]=="1") > format.html { redirect_to root_url+params[:menu] > +"/"+params[:menu1] } > else > format.html { render :action => "new" } > end > > format.xml { render :xml => @comment.errors, :status > => :unprocessable_entity } > end > end > > end > > please help ASAP. > > thanks > > rahul > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 6, 4:13 am, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> please help on this is urgent... >You haven''t really provided any detail - you''ve only provided the controller code, but none of the stuff showing how you setup validations Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hii Fredrick,, i have setup the in my comment module validates_presence_of(:name,:comment) and what other detail you need , and i have copied the new form as it is in to my public module, and set customer flag to 1, please help. thanks rahu On Thu, May 6, 2010 at 4:23 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On May 6, 4:13 am, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > please help on this is urgent... > > > > You haven''t really provided any detail - you''ve only provided the > controller code, but none of the stuff showing how you setup > validations > > Fred > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 6, 12:03 pm, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hii Fredrick,, > > i have setup the in my comment module > validates_presence_of(:name,:comment) >By module do you mean class ? Is the validation not triggering because a blank name still counts as present? Fred> and what other detail you need , and i have copied the new form as it is in > to my public module, > and set customer flag to 1, > > please help. > > thanks > > rahu > > On Thu, May 6, 2010 at 4:23 PM, Frederick Cheung <frederick.che...@gmail.com > > > > > > > wrote: > > > On May 6, 4:13 am, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > please help on this is urgent... > > > You haven''t really provided any detail - you''ve only provided the > > controller code, but none of the stuff showing how you setup > > validations > > > Fred > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hi fredrick module mean complete scaffold, and validation is not triggering and showing error because this new form is present in other module scaffold other model ... i have one public model and one comment model.. i have putted the comment add form in the public view and want to run the validation of comment model is that possible... thanks rahul On Thu, May 6, 2010 at 9:30 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On May 6, 12:03 pm, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > hii Fredrick,, > > > > i have setup the in my comment module > > validates_presence_of(:name,:comment) > > > > By module do you mean class ? Is the validation not triggering because > a blank name still counts as present? > > Fred > > and what other detail you need , and i have copied the new form as it is > in > > to my public module, > > and set customer flag to 1, > > > > please help. > > > > thanks > > > > rahu > > > > On Thu, May 6, 2010 at 4:23 PM, Frederick Cheung < > frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > > > > > > > > > > wrote: > > > > > On May 6, 4:13 am, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > please help on this is urgent... > > > > > You haven''t really provided any detail - you''ve only provided the > > > controller code, but none of the stuff showing how you setup > > > validations > > > > > Fred > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org><rubyonrails-talk%2Bunsubscrib > e@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > > For more options, visit this group athttp:// > groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.