Please help me get this running

11 views
Skip to first unread message

Jesse

unread,
Mar 1, 2010, 4:15:29 PM3/1/10
to Ruleby
I'm trying to get the curretn_user's milestone to change in the
rules. I can't get past the errors.

http://pastie.org/848757

Jason Nah

unread,
Mar 1, 2010, 5:32:20 PM3/1/10
to rul...@googlegroups.com
Hi Jesse,

I think the problem is that your controller doesn't know anything about ActionRulebook

You can solve this by editing your environment.rb and adding the search path there so that the rest of your app understands the app/rules directory...


Cheers,
Jason



--
You received this message because you are subscribed to the Google Groups "Ruleby" group.
To post to this group, send email to rul...@googlegroups.com.
To unsubscribe from this group, send email to ruleby+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruleby?hl=en.


Jesse

unread,
Mar 2, 2010, 1:59:48 AM3/2/10
to Ruleby
I put this line in the environment as in the sample app:
config.load_paths += ["#{RAILS_ROOT}/app/rules"]

I am curious how to perform operations via the rules. In my example:
http://pastie.org/848757
what I'm trying to do is change current_user.milestone according to
the rule. Now that the view loads, it doesn't change the milestone.
I understand that this is a very newb question, but please be patient.

Do I need to assign the 'retrieve'd element?-- such as:

current_user.milestone = retrieve(v[:m].status = 'next level')

thanks

On Mar 1, 4:32 pm, Jason Nah <jason....@gmail.com> wrote:
> Hi Jesse,
>
> I think the problem is that your controller doesn't know anything about
> ActionRulebook
>
> You can solve this by editing your environment.rb and adding the search path
> there so that the rest of your app understands the app/rules directory...
>
> Cheers,
> Jason
>

> On 2 March 2010 08:15, Jesse <teff...@gmail.com> wrote:
>
> > I'm trying to get the curretn_user's milestone to change in the
> > rules.  I can't get past the errors.
>
> >http://pastie.org/848757
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruleby" group.
> > To post to this group, send email to rul...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > ruleby+un...@googlegroups.com<ruleby%2Bunsu...@googlegroups.com>

Jesse

unread,
Mar 2, 2010, 3:04:37 AM3/2/10
to Ruleby
I'm doing a trial and error, getting nothing. Here is where I am
right now. http://pastie.org/849426

All I need to do at this point is match current_user.milestone

On Mar 1, 4:32 pm, Jason Nah <jason....@gmail.com> wrote:

> Hi Jesse,
>
> I think the problem is that your controller doesn't know anything about
> ActionRulebook
>
> You can solve this by editing your environment.rb and adding the search path
> there so that the rest of your app understands the app/rules directory...
>
> Cheers,
> Jason
>

> On 2 March 2010 08:15, Jesse <teff...@gmail.com> wrote:
>
> > I'm trying to get the curretn_user's milestone to change in the
> > rules.  I can't get past the errors.
>
> >http://pastie.org/848757
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruleby" group.
> > To post to this group, send email to rul...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > ruleby+un...@googlegroups.com<ruleby%2Bunsu...@googlegroups.com>

Matt Smith

unread,
Mar 2, 2010, 11:06:04 AM3/2/10
to rul...@googlegroups.com
Hi Jesse,

Have a look at this:  http://pastie.org/849965

If I am correct I think this is what you are trying to do.

The retrieve method is a method on the engine object, so you would want to call it after the match and it will return all facts of a certain type.

HTH,

Matt

To unsubscribe from this group, send email to ruleby+un...@googlegroups.com.

Jesse

unread,
Mar 2, 2010, 3:23:15 PM3/2/10
to Ruleby
This is very helpful, however I am not understanding a few things.

Why do I need to assert both current_user and
Action.new(current_user) ?

How do I assert only the User? (Instead of current_user.milestone)

Why am I getting back User or Action objects instead of, eg, "next
milestone"

Thanks again. Hopefully I can get warmed up to this and get some work
done.

On Mar 2, 10:06 am, Matt Smith <codeaspe...@gmail.com> wrote:
> Hi Jesse,
>
> Have a look at this:  http://pastie.org/849965
>
> If I am correct I think this is what you are trying to do.
>
> The retrieve method is a method on the engine object, so you would want to
> call it after the match and it will return all facts of a certain type.
>
> HTH,
>
> Matt
>

> On Tue, Mar 2, 2010 at 2:04 AM, Jesse <teff...@gmail.com> wrote:
> > I'm doing a trial and error, getting nothing.  Here is where I am
> > right now.  http://pastie.org/849426
>
> > All I need to do at this point is match current_user.milestone
>
> > On Mar 1, 4:32 pm, Jason Nah <jason....@gmail.com> wrote:
> > > Hi Jesse,
>
> > > I think the problem is that your controller doesn't know anything about
> > > ActionRulebook
>
> > > You can solve this by editing your environment.rb and adding the search
> > path
> > > there so that the rest of your app understands the app/rules directory...
>
> > > Cheers,
> > > Jason
>
> > > On 2 March 2010 08:15, Jesse <teff...@gmail.com> wrote:
>
> > > > I'm trying to get the curretn_user's milestone to change in the
> > > > rules.  I can't get past the errors.
>
> > > >http://pastie.org/848757
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Ruleby" group.
> > > > To post to this group, send email to rul...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > ruleby+un...@googlegroups.com<ruleby%2Bunsu...@googlegroups.com>

> > <ruleby%2Bunsu...@googlegroups.com<ruleby%252Buns...@googlegroups.com>

Jesse

unread,
Mar 2, 2010, 3:46:58 PM3/2/10
to Ruleby
The code I'm working with now, http://pastie.org/850515

I'm only passing a User.

On Mar 2, 10:06 am, Matt Smith <codeaspe...@gmail.com> wrote:

> Hi Jesse,
>
> Have a look at this:  http://pastie.org/849965
>
> If I am correct I think this is what you are trying to do.
>
> The retrieve method is a method on the engine object, so you would want to
> call it after the match and it will return all facts of a certain type.
>
> HTH,
>
> Matt
>

> On Tue, Mar 2, 2010 at 2:04 AM, Jesse <teff...@gmail.com> wrote:
> > I'm doing a trial and error, getting nothing.  Here is where I am
> > right now.  http://pastie.org/849426
>
> > All I need to do at this point is match current_user.milestone
>
> > On Mar 1, 4:32 pm, Jason Nah <jason....@gmail.com> wrote:
> > > Hi Jesse,
>
> > > I think the problem is that your controller doesn't know anything about
> > > ActionRulebook
>
> > > You can solve this by editing your environment.rb and adding the search
> > path
> > > there so that the rest of your app understands the app/rules directory...
>
> > > Cheers,
> > > Jason
>
> > > On 2 March 2010 08:15, Jesse <teff...@gmail.com> wrote:
>
> > > > I'm trying to get the curretn_user's milestone to change in the
> > > > rules.  I can't get past the errors.
>
> > > >http://pastie.org/848757
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Ruleby" group.
> > > > To post to this group, send email to rul...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > ruleby+un...@googlegroups.com<ruleby%2Bunsu...@googlegroups.com>

> > <ruleby%2Bunsu...@googlegroups.com<ruleby%252Buns...@googlegroups.com>

Matt Smith

unread,
Mar 3, 2010, 5:04:11 AM3/3/10
to rul...@googlegroups.com
Hi Jesse,

Looks like you do not need the Action class.  Have a look here:  http://pastie.org/851390
The rule now looks for a User and not an Action.

Matt

To unsubscribe from this group, send email to ruleby+un...@googlegroups.com.

Jesse Crockett

unread,
Mar 3, 2010, 6:40:55 AM3/3/10
to rul...@googlegroups.com
I just can't get it to work. I'm using Mongo. Does this require
ActiveRecord? When I inspect the retrieved object before manipulations,
there is no change, in that I don't see how the rule is being matched.
Does "m.milestone == :something" mean the same as "m.milestone ==
'something'"

in irb it doesn't work. What I'm doing is creating a new user when the
page loads. The user has a default milestone of
'preproduction_1_get_started', and in the controller
( http://pastie.org/851390 ), it seems like it should match the rule,
but apparently this is not the case.

logger.info users.first.inspect:

#<User _id: 4b8e4997106a6c74ba000001, facebook_id: 547669129,
created_at: Wed Mar 03 11:35:51 UTC 2010, session_key:
"2.iq1uWc0a8DDNJ8UDUwJ67Q__.3600.1267621200-547669129", updated_at: Wed
Mar 03 11:35:51 UTC 2010, milestone: "preproduction_1_get_started">

The milestone should be 'it_works' at this point, yes?

> +unsub...@googlegroups.com.


> For more options, visit this group at
> http://groups.google.com/group/ruleby?hl=en.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruleby" group.
> To post to this group, send email to rul...@googlegroups.com.
> To unsubscribe from this group, send email to ruleby

> +unsub...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages