Hi Jason

TQVM for your feedback and suggestion :-)

On 28 February 2017 at 00:55, Jason Fleetwood-Boldt <[email protected]>
wrote:

>
> Try adding a beginning_of_chain to your controller, like so:
>
> def beginning_of_chain
>   if action_name == "index" && ! params[:embedded]
>     nested? ? super : active_scaffold_config.model.your_scope
>   else
>     super
>   end
> end
>
>
> Then, add a scope called :your_scope (obviously, don't call it
> "your_scope" — this is for demonstration purposes). It would look something
> like this:
>
> scope :your_scope, -> where("clients.eno = 'CCH'")
>
> The code you see in my beginning_of_chain restricts this to only the index
> action and excludes it from embedded scaffolds, where we don't actually
> want to limit the scope in our app. (So you may not need that if statement.)
>
> -Jason
>
>
>
>
>
> > On Feb 25, 2017, at 6:49 AM, Chee Chong Hwa <[email protected]>
> wrote:
> >
> > Hi Sergio
> >
> > Where should I put the following code to restrict the display in the
> active_scaffold list
> > Client.find_by_sql("SELECT * FROM clients where clients.eno = 'CCH' ")
> >
> > TIA
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails Gem" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at https://groups.google.com/group/activescaffold.
> > For more options, visit https://groups.google.com/d/optout.
>
> ----
>
> Jason Fleetwood-Boldt
> [email protected]
> http://www.jasonfleetwoodboldt.com/writing
>
> If you'd like to reply by encrypted email you can find my public key on
> jasonfleetwoodboldt.com (more about setting GPG: https://gpgtools.org)
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ActiveScaffold : Ruby on Rails Gem" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/activescaffold/hClrbM3DuKs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/activescaffold.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to