I''ve created a new action in my invitations controller named validate and validation controller/invitations_controller.rb def validate end def validation @invitation = Invitation.find(params(:key)) if @invitation != nil redirect_to new_client_path, :notice => ''Codigo Aceptado'' else flash.now[:alert] = ''Ingrese un codigo valido'' render :action => ''validate'' end end _validation_form.html.erb <%= form_tag invitations_validate_path do %> <div class="field"> <%= label_tag :key %><br /> <%= text_field_tag :key %> </div> <div class="actions"> <%= submit_tag ''validate'', :action => ''validation'' %> </div> <% end %> So when I enter a valid key I get redirected to create a user, but this isn''t working. the submit isnt doing anything, the :action => validation is not working config/routes.rb resources :invitations do collection do get :validate get :validation end end -- Posted via http://www.ruby-forum.com/. -- 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 Apr 17, 9:12 pm, "Jose tomas R." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''ve created a new action in my invitations controller named > validate and validation > > controller/invitations_controller.rb > > def validate > end > > def validation > @invitation = Invitation.find(params(:key)) >shouldn''t that be params[:key] ?> if @invitation != nil > redirect_to new_client_path, :notice => ''Codigo Aceptado'' > else > flash.now[:alert] = ''Ingrese un codigo valido'' > render :action => ''validate'' > end > end > > _validation_form.html.erb > > <%= form_tag invitations_validate_path do %> > <div class="field"> > <%= label_tag :key %><br /> > <%= text_field_tag :key %> > </div> > <div class="actions"> > <%= submit_tag ''validate'', :action => ''validation'' %> > </div> > <% end %> > > So when I enter a valid key I get redirected to create a user, but this > isn''t working. the submit isnt doing anything, the :action => validation > is not workingIt''s not supposed to. A form''s action is specified on the form element itself, not on submit tags. You''ve written form_tag invitations_validate_path, so the form gets sent to invitations_validate_path (ie your valdiate action) Fred> > config/routes.rb > > resources :invitations do > collection do > get :validate > get :validation > end > end > > -- > Posted viahttp://www.ruby-forum.com/.-- 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.
so you say that should be form_for params[:key]? that wont work neither -- Posted via http://www.ruby-forum.com/. -- 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 Mon, Apr 18, 2011 at 6:01 PM, Tomas R. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> so you say that should be form_for params[:key]? that wont work neither > >You only fixed part of the issue. Fred pointed out two things. The first was that you specified params[:key] incorrectly. The second, and more important, is that you put your :action in the wrong place. Remove the :action from your submit tag and change your form_tag to go to invitations_validation_path. <%= form_tag invitations_validation_path do %> <div class="field"> <%= label_tag :key %><br /> <%= text_field_tag :key %> </div> <div class="actions"> <%= submit_tag ''validate'' %> </div> <% end %> B. -- 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.