Well, to be honest you should nt call respond_to_action at all...
Maybe just some examples:
#member action
def fire
process_action_link_action do |record|
begin
record.update_attributes!(:first_name => 'updated')
self.successful = true
rescue
self.successful = false
end
end
end
#collection action_link
def fire2
process_action_link_action do
self.successful = true
flash[:info] = 'did it again'
end
end
On 14 Jun., 17:02, Nick Rogers <[email protected]> wrote:
> I read that, and it works for a :member action link. I am unsure how to
> change it to correctly work for a collection. Specifically, what
> should respond_to_action(:action_update) be changed to?
>
> Thanks.
>
> On Tue, Jun 14, 2011 at 7:57 AM, vhochstein <[email protected]>wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > please take a look at:
> >http://vhochstein.wordpress.com/2010/12/03/activescaffold-confirmatio...
>
> > hope that helps.
>
> > --
> > Volker
>
> > On Jun 13, 8:41 pm, Nick Rogers <[email protected]> wrote:
> > > I'm trying to add a simple custom action_link that modifies another
> > > table/model and then displays a message to the user in
> > > active_scaffolds flash[:notice].
>
> > > Here is my action_link
>
> > > config.action_links.add 'flush_all',
> > > :action => 'flush_all', :page => :true,
> > > :type => :collection, :label => 'Flush All', :crud_type
> > > => :destroy,
> > > :security_method => :delete_authorized?,
> > > :inline => false, :position => :false,
> > > :confirm => 'Click OK to continue.'
>
> > > Here is the method in the active_scaffold controller
>
> > > def flush_all
> > > # bogus code that does stuff
> > > HappyPeople.find_or_initialize_by_name('happy_person').save!
> > > flash[:info] = 'happy person updated'
> > > return_to_main
> > > end
>
> > > When I click on the link from the scaffold and click OK in the
> > > javascript popup, the action is run as a JS request and I never see
> > > the flash message. If I hit the URL of the action link directly
> > > (e.g., /happy_peoples/flush_all/) the action is run and I see the
> > > flash message. How can I make the action_link open with HTML behavior
> > > and not JS. I thought this is what :page => :true was supposed to do?
>
> > > Thanks.
>
> > > -Nick
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "ActiveScaffold : Ruby on Rails plugin" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/activescaffold?hl=en.
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.