adding constrains with conditions

22 views
Skip to first unread message

slava

unread,
Oct 1, 2011, 8:36:40 PM10/1/11
to ActiveScaffold : Ruby on Rails plugin
Hello,
Trying to add an embeded active scaffold with constrains checking a
condition.

Something like this..
render :active_scaffold => "option_terms", :constraints =>
{ 'expires_at > ?' => DateTime.now.utc }

I am getting an error:
Malformed constraint `OptionTerms#expires_at > ?'

What is the correct format for this? Thanks.

clyfe

unread,
Oct 2, 2011, 11:43:04 AM10/2/11
to actives...@googlegroups.com
Constraints only support equality based rules. What you need to use is conditions:

render :active_scaffold => "option_terms",
  :conditions => {'expires_at > ?' => DateTime.now.utc}


Slava Mikerin

unread,
Oct 2, 2011, 10:18:17 PM10/2/11
to actives...@googlegroups.com
Thank you. Do you know how I can trigger a data reload for an embedded
scaffold with new conditions set after a user makes a selection on a
page somewhere (for example dropdown select) should trigger reloading
of active_scaffold data.

> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails plugin" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/activescaffold/-/tNR68JPDlfoJ.
> To post to this group, send email to actives...@googlegroups.com.
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.
>

Reply all
Reply to author
Forward
0 new messages