I have the below model that gets created with create action with :running field having value of false. class Portal include Mongoid::Document field :url, :type => String field :user, :type => String field :password, :type => String field :running, :type => Boolean, :default => false end Later I want to set :running to true. I want to use the button_to form helper method to set running to true. The button is installed in the index view. What arguments needs to be passed to the button_to method? Thanks, Alex -- 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 2, 7:03 pm, Alex Katebi <alex.kat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have the below model that gets created with create action with :running > field having value of false. > > class Portal > include Mongoid::Document > field :url, :type => String > field :user, :type => String > field :password, :type => String > field :running, :type => Boolean, :default => false > end > > Later I want to set :running to true. I want to use the button_to form > helper method to set running to true. > The button is installed in the index view. > What arguments needs to be passed to the button_to method? >Well you''ll want an action that loads the relevant Portal object and updates it and then call button_to with the routing options for that action. Fred> Thanks, > Alex-- 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.
Ho do I pass the running field with the button_to method On Mon, May 2, 2011 at 3:10 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On May 2, 7:03 pm, Alex Katebi <alex.kat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have the below model that gets created with create action with :running > > field having value of false. > > > > class Portal > > include Mongoid::Document > > field :url, :type => String > > field :user, :type => String > > field :password, :type => String > > field :running, :type => Boolean, :default => false > > end > > > > Later I want to set :running to true. I want to use the button_to form > > helper method to set running to true. > > The button is installed in the index view. > > What arguments needs to be passed to the button_to method? > > > Well you''ll want an action that loads the relevant Portal object and > updates it and then call button_to with the routing options for that > action. > > Fred > > > Thanks, > > Alex > > -- > 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. > >-- 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 2, 9:50 pm, Alex Katebi <alex.kat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ho do I pass the running field with the button_to method >That depends on how you''ve written the action the button links to. if the action looked like def start p = Portal.find(params[:id]) p.running = true p.save! end then you don''t need to pass anything beyond the id of the object that needs updating Fred> On Mon, May 2, 2011 at 3:10 PM, Frederick Cheung <frederick.che...@gmail.com > > > > > wrote: > > > On May 2, 7:03 pm, Alex Katebi <alex.kat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have the below model that gets created with create action with :running > > > field having value of false. > > > > class Portal > > > include Mongoid::Document > > > field :url, :type => String > > > field :user, :type => String > > > field :password, :type => String > > > field :running, :type => Boolean, :default => false > > > end > > > > Later I want to set :running to true. I want to use the button_to form > > > helper method to set running to true. > > > The button is installed in the index view. > > > What arguments needs to be passed to the button_to method? > > > Well you''ll want an action that loads the relevant Portal object and > > updates it and then call button_to with the routing options for that > > action. > > > Fred > > > > Thanks, > > > Alex > > > -- > > 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.-- 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.