Hello everybody, I have a problem with a submit_tag, because it doesn''t work. Here is the form which i want to submit. <% form_for :responsible, :url => responsibles_profiles_path(@responsible), :html => {:method => :put, :multipart=>true} do |f| -%> <fieldset> <div class="fields"> <fieldset > <legend><%I18n.t("tog_social.profiles.model.responsible_with_index") %></legend> <p> <label for="responsible_name"><%I18n.t("tog_social.profiles.model.responsible_name") %></label> <%= f.text_field :responsible_name, :class=>"fieldbox wide" %> </p> <p> <label for="responsible_email"><%I18n.t("tog_social.profiles.model.responsible_email") %></label> <%= f.text_field :responsible_email, :class=>"fieldbox wide" %> </p> <p> <label for="responsible_tlf"><%I18n.t("tog_social.profiles.model.responsible_tlf") %></label> <%= f.text_field :responsible_tlf, :class=>"fieldbox wide" %> </p> </fieldset> </div> </fieldset> <br /> <!--Añadimos el botón actualizar responsable--> <div class="actions"> <%= submit_tag I18n.t(''tog_social.profiles.member.update_responsible''), {:accesskey => "s", :class=>"button mainaction"} %> </div> <% end -%> And this submit doesn''t work. In the controller i have the next code to update the responsible. def update_responsible responsible = Responsible.find(params[:responsible]) responsible.update_attributes!(params[:responsible]) responsible.save flash[:ok] = I18n.t("tog_social.profiles.member.updated") redirect_to profile_path(profile) end And i want to know how can i resolve this problem? thanks for your help. -- 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 Wed, Nov 3, 2010 at 6:13 AM, h0bit <jsantana.gcc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello everybody, > > I have a problem with a submit_tag, because it doesn''t work. > > Here is the form which i want to submit. > > <% form_for :responsible, :url => > responsibles_profiles_path(@responsible), :html => {:method > => :put, :multipart=>true} do |f| -%> > <fieldset> > <div class="fields"> > <fieldset > > <legend><%> I18n.t("tog_social.profiles.model.responsible_with_index") %></legend> > <p> > <label for="responsible_name"><%> I18n.t("tog_social.profiles.model.responsible_name") %></label> > <%= f.text_field :responsible_name, > :class=>"fieldbox wide" %> > </p> > <p> > <label for="responsible_email"><%> I18n.t("tog_social.profiles.model.responsible_email") %></label> > <%= f.text_field :responsible_email, > :class=>"fieldbox wide" %> > </p> > <p> > <label for="responsible_tlf"><%> I18n.t("tog_social.profiles.model.responsible_tlf") %></label> > <%= f.text_field :responsible_tlf, > :class=>"fieldbox wide" %> > </p> > </fieldset> > </div> > </fieldset> > <br /> > > <!--Añadimos el botón actualizar responsable--> > <div class="actions"> > <%= submit_tag > I18n.t(''tog_social.profiles.member.update_responsible''), {:accesskey > => "s", :class=>"button mainaction"} %> > </div> > > <% end -%> > > And this submit doesn''t work. >What do you mean "doesn''t work"? When you press, does the browser try to navagate? Do you see any output from the rails server console? Error messages?> > In the controller i have the next code to update the responsible. > > def update_responsible > responsible = Responsible.find(params[:responsible]) > responsible.update_attributes!(params[:responsible]) > responsible.save > flash[:ok] = I18n.t("tog_social.profiles.member.updated") > redirect_to profile_path(profile) > end > > And i want to know how can i resolve this problem? > > thanks for your help. > > -- > 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The submit doesn''t do what i want, it means that the submit doesn''t update the responsibles. I don''t see any error messages. Only the browser charguing and then redirect to the same view. So what is the problem? maybe something in the routes? i don''t know but please help me. Thanks. On 3 nov, 13:20, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> On Wed, Nov 3, 2010 at 6:13 AM, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello everybody, > > > I have a problem with a submit_tag, because it doesn''t work. > > > Here is the form which i want to submit. > > > <% form_for :responsible, :url => > > responsibles_profiles_path(@responsible), :html => {:method > > => :put, :multipart=>true} do |f| -%> > > <fieldset> > > <div class="fields"> > > <fieldset > > > <legend><%> > I18n.t("tog_social.profiles.model.responsible_with_index") %></legend> > > <p> > > <label for="responsible_name"><%> > I18n.t("tog_social.profiles.model.responsible_name") %></label> > > <%= f.text_field :responsible_name, > > :class=>"fieldbox wide" %> > > </p> > > <p> > > <label for="responsible_email"><%> > I18n.t("tog_social.profiles.model.responsible_email") %></label> > > <%= f.text_field :responsible_email, > > :class=>"fieldbox wide" %> > > </p> > > <p> > > <label for="responsible_tlf"><%> > I18n.t("tog_social.profiles.model.responsible_tlf") %></label> > > <%= f.text_field :responsible_tlf, > > :class=>"fieldbox wide" %> > > </p> > > </fieldset> > > </div> > > </fieldset> > > <br /> > > > <!--Añadimos el botón actualizar responsable--> > > <div class="actions"> > > <%= submit_tag > > I18n.t(''tog_social.profiles.member.update_responsible''), {:accesskey > > => "s", :class=>"button mainaction"} %> > > </div> > > > <% end -%> > > > And this submit doesn''t work. > > What do you mean "doesn''t work"? When you press, does the browser try to > navagate? Do you see any output from the rails server console? Error > messages? > > > > > In the controller i have the next code to update the responsible. > > > def update_responsible > > responsible = Responsible.find(params[:responsible]) > > responsible.update_attributes!(params[:responsible]) > > responsible.save > > flash[:ok] = I18n.t("tog_social.profiles.member.updated") > > redirect_to profile_path(profile) > > end > > > And i want to know how can i resolve this problem? > > > thanks for your help. > > > -- > > 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 3 November 2010 13:30, h0bit <jsantana.gcc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The submit doesn''t do what i want, it means that the submit doesn''t > update the responsibles. I don''t see any error messages. Only the > browser charguing and then redirect to the same view.Have a look in the log (log/development.log assuming you are in development mode) and see what happens when you click the button. Also you can use ruby-debug to break into your application to see what is happening. See the Rails Guide on Debugging. I presume you have checked the generated html (View, Page Source or similar in your browser) to check the html is what you expect. Colin -- 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.
I have one question for each submit i need a route in the file route.rb? i think that''s my error. On 3 nov, 13:34, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 3 November 2010 13:30, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > The submit doesn''t do what i want, it means that the submit doesn''t > > update the responsibles. I don''t see any error messages. Only the > > browser charguing and then redirect to the same view. > > Have a look in the log (log/development.log assuming you are in > development mode) and see what happens when you click the button. > > Also you can use ruby-debug to break into your application to see what > is happening. See the Rails Guide on Debugging. > > I presume you have checked the generated html (View, Page Source or > similar in your browser) to check the html is what you expect. > > Colin-- 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 3 nov, 17:14, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have one question for each submit i need a route in the file > route.rb? > > i think that''s my error.And why when i click on the submit butto redirect to the same page?> > On 3 nov, 13:34, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > On 3 November 2010 13:30, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > The submit doesn''t do what i want, it means that the submit doesn''t > > > update the responsibles. I don''t see any error messages. Only the > > > browser charguing and then redirect to the same view. > > > Have a look in the log (log/development.log assuming you are in > > development mode) and see what happens when you click the button. > > > Also you can use ruby-debug to break into your application to see what > > is happening. See the Rails Guide on Debugging. > > > I presume you have checked the generated html (View, Page Source or > > similar in your browser) to check the html is what you expect. > > > Colin-- 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 Wed, Nov 3, 2010 at 11:14 AM, h0bit <jsantana.gcc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have one question for each submit i need a route in the file > route.rb? > > i think that''s my error. >No, if there was an error with routes you would not be redirecting to the same page, and would be getting a disgusting error. The issue is probably in your controller.> > On 3 nov, 13:34, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > On 3 November 2010 13:30, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > The submit doesn''t do what i want, it means that the submit doesn''t > > > update the responsibles. I don''t see any error messages. Only the > > > browser charguing and then redirect to the same view. > > > > Have a look in the log (log/development.log assuming you are in > > development mode) and see what happens when you click the button. > > > > Also you can use ruby-debug to break into your application to see what > > is happening. See the Rails Guide on Debugging. > > > > I presume you have checked the generated html (View, Page Source or > > similar in your browser) to check the html is what you expect. > > > > Colin > > -- > 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.
But in my controller i have the next: def update_responsible responsible = Responsible.find(params[:responsible]) responsible.update_attributes!(params[:responsible]) responsible.save flash[:ok] = I18n.t("tog_social.profiles.member.updated") redirect_to profile_path(profile) end so i don''t know what i''m doing wrong? i thinks it''s easy but don''t see. On 3 nov, 17:23, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> On Wed, Nov 3, 2010 at 11:14 AM, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have one question for each submit i need a route in the file > > route.rb? > > > i think that''s my error. > > No, if there was an error with routes you would not be redirecting to the > same page, and would be getting a disgusting error. The issue is probably in > your controller. > > > > > On 3 nov, 13:34, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > On 3 November 2010 13:30, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > The submit doesn''t do what i want, it means that the submit doesn''t > > > > update the responsibles. I don''t see any error messages. Only the > > > > browser charguing and then redirect to the same view. > > > > Have a look in the log (log/development.log assuming you are in > > > development mode) and see what happens when you click the button. > > > > Also you can use ruby-debug to break into your application to see what > > > is happening. See the Rails Guide on Debugging. > > > > I presume you have checked the generated html (View, Page Source or > > > similar in your browser) to check the html is what you expect. > > > > Colin > > > -- > > 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 3 November 2010 17:36, h0bit <jsantana.gcc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> But in my controller i have the next: > > def update_responsible > responsible = Responsible.find(params[:responsible]) > responsible.update_attributes!(params[:responsible]) > responsible.save > flash[:ok] = I18n.t("tog_social.profiles.member.updated") > redirect_to profile_path(profile) > end > > so i don''t know what i''m doing wrong?Did you try my suggestions (see below)?> > i thinks it''s easy but don''t see. > > On 3 nov, 17:23, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: >> On Wed, Nov 3, 2010 at 11:14 AM, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > I have one question for each submit i need a route in the file >> > route.rb? >> >> > i think that''s my error. >> >> No, if there was an error with routes you would not be redirecting to the >> same page, and would be getting a disgusting error. The issue is probably in >> your controller. >> >> >> >> > On 3 nov, 13:34, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> > > On 3 November 2010 13:30, h0bit <jsantana....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > > > The submit doesn''t do what i want, it means that the submit doesn''t >> > > > update the responsibles. I don''t see any error messages. Only the >> > > > browser charguing and then redirect to the same view. >>These suggestions:>> > > Have a look in the log (log/development.log assuming you are in >> > > development mode) and see what happens when you click the button. >> >> > > Also you can use ruby-debug to break into your application to see what >> > > is happening. See the Rails Guide on Debugging. >> >> > > I presume you have checked the generated html (View, Page Source or >> > > similar in your browser) to check the html is what you expect.Colin -- 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.