updating records

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

updating records

Joe Guerra

I know how to update records, but not sure where I should put my code when product qty == 0.
I do have a flash notice on the show page that displays a message when the last item is left. 

 Should I put update the records on the show page as well ?  (when qty == 0 )

Thanks,
Joe  

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d42a9d8f-ac89-49d1-bb26-7485877e3b84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Colin Law
On Wed, 22 Aug 2018 at 15:36, Joe Guerra <[hidden email]> wrote:
>
>
> I know how to update records, but not sure where I should put my code when product qty == 0.
> I do have a flash notice on the show page that displays a message when the last item is left.
>
>  Should I put update the records on the show page as well ?  (when qty == 0 )

Your question is difficult to understand given that we have no
knowledge of your application other than the text above.  Why do you
need to update any records if the the quantity is already 0?

Colin

>
> Thanks,
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d42a9d8f-ac89-49d1-bb26-7485877e3b84%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsYncfSeOXSv6SCYq3XXfoxYuq8sMVUqm-h9H03U29hag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
ok, well I need to flip a few boolean values to begin the group order process.   



On Wed, Aug 22, 2018 at 11:22 AM, Colin Law <[hidden email]> wrote:
On Wed, 22 Aug 2018 at 15:36, Joe Guerra <[hidden email]> wrote:
>
>
> I know how to update records, but not sure where I should put my code when product qty == 0.
> I do have a flash notice on the show page that displays a message when the last item is left.
>
>  Should I put update the records on the show page as well ?  (when qty == 0 )

Your question is difficult to understand given that we have no
knowledge of your application other than the text above.  Why do you
need to update any records if the the quantity is already 0?

Colin

>
> Thanks,
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d42a9d8f-ac89-49d1-bb26-7485877e3b84%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsYncfSeOXSv6SCYq3XXfoxYuq8sMVUqm-h9H03U29hag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMnrpt%3DtX6s7f8JaJDVWZ82xSiGJ4b-VKP7ZW_LLey7b8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Colin Law
On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>
> ok, well I need to flip a few boolean values to begin the group order process.

Oh, you mean that when the amount goes to zero you need to take some
action?  In that case that should probably be initiated by the action
that sets it zero, either directly on updating it to zero or possibly
in an after filter.  Or have a background job that looks for zero and
takes the appropriate action.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtydNYkNhafJHtuZztwzqkwdMYCFAXZntTKcZoVmw2xLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,

(because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."

Thanks,
Joe


On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
On Wed, 22 Aug 2018 at 16:31, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="AFabbb8bAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jgu...@...> wrote:
>
> ok, well I need to flip a few boolean values to begin the group order process.

Oh, you mean that when the amount goes to zero you need to take some
action?  In that case that should probably be initiated by the action
that sets it zero, either directly on updating it to zero or possibly
in an after filter.  Or have a background job that looks for zero and
takes the appropriate action.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Colin Law
On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
>
> Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,

You shouldn't be doing it in a view at all, you should do it in the
action or model that updates the quantity, when it sees it is zero.

Colin

>
> (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>
> Thanks,
> Joe
>
>
> On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>>
>> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> >
>> > ok, well I need to flip a few boolean values to begin the group order process.
>>
>> Oh, you mean that when the amount goes to zero you need to take some
>> action?  In that case that should probably be initiated by the action
>> that sets it zero, either directly on updating it to zero or possibly
>> in an after filter.  Or have a background job that looks for zero and
>> takes the appropriate action.
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
Yes, in the product controller? 

In 
Def show
End

On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
>
> Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,

You shouldn't be doing it in a view at all, you should do it in the
action or model that updates the quantity, when it sees it is zero.

Colin

>
> (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>
> Thanks,
> Joe
>
>
> On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>>
>> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> >
>> > ok, well I need to flip a few boolean values to begin the group order process.
>>
>> Oh, you mean that when the amount goes to zero you need to take some
>> action?  In that case that should probably be initiated by the action
>> that sets it zero, either directly on updating it to zero or possibly
>> in an after filter.  Or have a background job that looks for zero and
>> takes the appropriate action.
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Colin Law
On Wed, 22 Aug 2018 at 17:17, Joe Guerra <[hidden email]> wrote:
>
> Yes, in the product controller?
>
> In
> Def show
> End

That is not a page that is a controller action, which invokes a view.
It is important to use the correct words or others will not know what
you mean.  By page I assumed you meant the view.  But surely you are
not changing the quantity in that action, I would have expected a
change in quantity to be in an Update action.

Colin

>
> On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
>>
>> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
>> >
>> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
>>
>> You shouldn't be doing it in a view at all, you should do it in the
>> action or model that updates the quantity, when it sees it is zero.
>>
>> Colin
>>
>> >
>> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>> >
>> > Thanks,
>> > Joe
>> >
>> >
>> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>> >>
>> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> >> >
>> >> > ok, well I need to flip a few boolean values to begin the group order process.
>> >>
>> >> Oh, you mean that when the amount goes to zero you need to take some
>> >> action?  In that case that should probably be initiated by the action
>> >> that sets it zero, either directly on updating it to zero or possibly
>> >> in an after filter.  Or have a background job that looks for zero and
>> >> takes the appropriate action.
>> >>
>> >> Colin
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > To post to this group, send email to [hidden email].
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> To post to this group, send email to [hidden email].
>> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLu9ZEqhfOiAijJ-azKvqO7edysG%3DMjMVa679dVXp5sfoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
ok, so I got it working...

the process is add to cart ....  my show page updates quantity... and if it reached 0 now i've got it updating and redirecting to root_path.

works like a charm.  (not sure if that's optimal).

On Wednesday, August 22, 2018 at 12:34:02 PM UTC-4, Colin Law wrote:
On Wed, 22 Aug 2018 at 17:17, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">JGu...@...> wrote:
>
> Yes, in the product controller?
>
> In
> Def show
> End

That is not a page that is a controller action, which invokes a view.
It is important to use the correct words or others will not know what
you mean.  By page I assumed you meant the view.  But surely you are
not changing the quantity in that action, I would have expected a
change in quantity to be in an Update action.

Colin

>
> On Wed, Aug 22, 2018, 12:00 PM Colin Law, <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cla...@...> wrote:
>>
>> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">JGu...@...> wrote:
>> >
>> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
>>
>> You shouldn't be doing it in a view at all, you should do it in the
>> action or model that updates the quantity, when it sees it is zero.
>>
>> Colin
>>
>> >
>> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>> >
>> > Thanks,
>> > Joe
>> >
>> >
>> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>> >>
>> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> >> >
>> >> > ok, well I need to flip a few boolean values to begin the group order process.
>> >>
>> >> Oh, you mean that when the amount goes to zero you need to take some
>> >> action?  In that case that should probably be initiated by the action
>> >> that sets it zero, either directly on updating it to zero or possibly
>> >> in an after filter.  Or have a background job that looks for zero and
>> >> takes the appropriate action.
>> >>
>> >> Colin
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
>> > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
>> > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
>> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
>> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
>> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="O6KtUlgeAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
I've got to fix my default scope.

On Wed, Aug 22, 2018 at 1:23 PM, Joe Guerra <[hidden email]> wrote:
ok, so I got it working...

the process is add to cart ....  my show page updates quantity... and if it reached 0 now i've got it updating and redirecting to root_path.

works like a charm.  (not sure if that's optimal).

On Wednesday, August 22, 2018 at 12:34:02 PM UTC-4, Colin Law wrote:
On Wed, 22 Aug 2018 at 17:17, Joe Guerra <[hidden email]> wrote:
>
> Yes, in the product controller?
>
> In
> Def show
> End

That is not a page that is a controller action, which invokes a view.
It is important to use the correct words or others will not know what
you mean.  By page I assumed you meant the view.  But surely you are
not changing the quantity in that action, I would have expected a
change in quantity to be in an Update action.

Colin

>
> On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
>>

>> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
>> >
>> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
>>
>> You shouldn't be doing it in a view at all, you should do it in the
>> action or model that updates the quantity, when it sees it is zero.
>>
>> Colin
>>
>> >
>> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>> >
>> > Thanks,
>> > Joe
>> >
>> >
>> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>> >>
>> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> >> >
>> >> > ok, well I need to flip a few boolean values to begin the group order process.
>> >>
>> >> Oh, you mean that when the amount goes to zero you need to take some
>> >> action?  In that case that should probably be initiated by the action
>> >> that sets it zero, either directly on updating it to zero or possibly
>> >> in an after filter.  Or have a background job that looks for zero and
>> >> takes the appropriate action.
>> >>
>> >> Colin
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to [hidden email].
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> To post to this group, send email to [hidden email].
>> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Walter Lee Davis

> On Aug 22, 2018, at 1:28 PM, Joe Guerra <[hidden email]> wrote:
>
> I've got to fix my default scope.

Default scopes are a serious anti-pattern, and cause more pain than they solve. I cannot think of one time I used them that I didn't regret it later.

Walter

>
> On Wed, Aug 22, 2018 at 1:23 PM, Joe Guerra <[hidden email]> wrote:
> ok, so I got it working...
>
> the process is add to cart ....  my show page updates quantity... and if it reached 0 now i've got it updating and redirecting to root_path.
>
> works like a charm.  (not sure if that's optimal).
>
> On Wednesday, August 22, 2018 at 12:34:02 PM UTC-4, Colin Law wrote:
> On Wed, 22 Aug 2018 at 17:17, Joe Guerra <[hidden email]> wrote:
> >
> > Yes, in the product controller?
> >
> > In
> > Def show
> > End
>
> That is not a page that is a controller action, which invokes a view.
> It is important to use the correct words or others will not know what
> you mean.  By page I assumed you meant the view.  But surely you are
> not changing the quantity in that action, I would have expected a
> change in quantity to be in an Update action.
>
> Colin
>
> >
> > On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
> >>
> >> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
> >> >
> >> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
> >>
> >> You shouldn't be doing it in a view at all, you should do it in the
> >> action or model that updates the quantity, when it sees it is zero.
> >>
> >> Colin
> >>
> >> >
> >> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
> >> >
> >> > Thanks,
> >> > Joe
> >> >
> >> >
> >> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
> >> >>
> >> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
> >> >> >
> >> >> > ok, well I need to flip a few boolean values to begin the group order process.
> >> >>
> >> >> Oh, you mean that when the amount goes to zero you need to take some
> >> >> action?  In that case that should probably be initiated by the action
> >> >> that sets it zero, either directly on updating it to zero or possibly
> >> >> in an after filter.  Or have a background job that looks for zero and
> >> >> takes the appropriate action.
> >> >>
> >> >> Colin
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> >> > To post to this group, send email to [hidden email].
> >> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
> >> > For more options, visit https://groups.google.com/d/optout.
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> >> To post to this group, send email to [hidden email].
> >> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2AB4A5DA-47E6-4E9B-B046-14C313E355ED%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
Yes, I know. 

I learned about using the default scope, then put it into my app.  Then I discovered everyone said not to use them.   lol.



On Wednesday, August 22, 2018 at 8:08:53 PM UTC-4, Walter Lee Davis wrote:

> On Aug 22, 2018, at 1:28 PM, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi4xrSo3AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jgu...@...> wrote:
>
> I've got to fix my default scope.

Default scopes are a serious anti-pattern, and cause more pain than they solve. I cannot think of one time I used them that I didn't regret it later.

Walter

>
> On Wed, Aug 22, 2018 at 1:23 PM, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi4xrSo3AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">JGu...@...> wrote:
> ok, so I got it working...
>
> the process is add to cart ....  my show page updates quantity... and if it reached 0 now i've got it updating and redirecting to root_path.
>
> works like a charm.  (not sure if that's optimal).
>
> On Wednesday, August 22, 2018 at 12:34:02 PM UTC-4, Colin Law wrote:
> On Wed, 22 Aug 2018 at 17:17, Joe Guerra <[hidden email]> wrote:
> >
> > Yes, in the product controller?
> >
> > In
> > Def show
> > End
>
> That is not a page that is a controller action, which invokes a view.
> It is important to use the correct words or others will not know what
> you mean.  By page I assumed you meant the view.  But surely you are
> not changing the quantity in that action, I would have expected a
> change in quantity to be in an Update action.
>
> Colin
>
> >
> > On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
> >>
> >> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
> >> >
> >> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
> >>
> >> You shouldn't be doing it in a view at all, you should do it in the
> >> action or model that updates the quantity, when it sees it is zero.
> >>
> >> Colin
> >>
> >> >
> >> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
> >> >
> >> > Thanks,
> >> > Joe
> >> >
> >> >
> >> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
> >> >>
> >> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
> >> >> >
> >> >> > ok, well I need to flip a few boolean values to begin the group order process.
> >> >>
> >> >> Oh, you mean that when the amount goes to zero you need to take some
> >> >> action?  In that case that should probably be initiated by the action
> >> >> that sets it zero, either directly on updating it to zero or possibly
> >> >> in an after filter.  Or have a background job that looks for zero and
> >> >> takes the appropriate action.
> >> >>
> >> >> Colin
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> >> > To post to this group, send email to [hidden email].
> >> > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
> >> > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> >> To post to this group, send email to [hidden email].
> >> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
> >> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
> > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi4xrSo3AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi4xrSo3AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com.
>
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi4xrSo3AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi4xrSo3AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b3d7b973-6ee6-4ca4-96e5-f40d3ff9a536%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Colin Law
On Sun, 26 Aug 2018 at 17:20, Joe Guerra <[hidden email]> wrote:
>
> Yes, I know.
>
> I learned about using the default scope, then put it into my app.  Then I discovered everyone said not to use them.   lol.

Yes, default scope seems like a good idea initially, but it often end
with tears :(

Colin

>
>
>
> On Wednesday, August 22, 2018 at 8:08:53 PM UTC-4, Walter Lee Davis wrote:
>>
>>
>> > On Aug 22, 2018, at 1:28 PM, Joe Guerra <[hidden email]> wrote:
>> >
>> > I've got to fix my default scope.
>>
>> Default scopes are a serious anti-pattern, and cause more pain than they solve. I cannot think of one time I used them that I didn't regret it later.
>>
>> Walter
>>
>> >
>> > On Wed, Aug 22, 2018 at 1:23 PM, Joe Guerra <[hidden email]> wrote:
>> > ok, so I got it working...
>> >
>> > the process is add to cart ....  my show page updates quantity... and if it reached 0 now i've got it updating and redirecting to root_path.
>> >
>> > works like a charm.  (not sure if that's optimal).
>> >
>> > On Wednesday, August 22, 2018 at 12:34:02 PM UTC-4, Colin Law wrote:
>> > On Wed, 22 Aug 2018 at 17:17, Joe Guerra <[hidden email]> wrote:
>> > >
>> > > Yes, in the product controller?
>> > >
>> > > In
>> > > Def show
>> > > End
>> >
>> > That is not a page that is a controller action, which invokes a view.
>> > It is important to use the correct words or others will not know what
>> > you mean.  By page I assumed you meant the view.  But surely you are
>> > not changing the quantity in that action, I would have expected a
>> > change in quantity to be in an Update action.
>> >
>> > Colin
>> >
>> > >
>> > > On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
>> > >>
>> > >> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
>> > >> >
>> > >> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
>> > >>
>> > >> You shouldn't be doing it in a view at all, you should do it in the
>> > >> action or model that updates the quantity, when it sees it is zero.
>> > >>
>> > >> Colin
>> > >>
>> > >> >
>> > >> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>> > >> >
>> > >> > Thanks,
>> > >> > Joe
>> > >> >
>> > >> >
>> > >> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>> > >> >>
>> > >> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> > >> >> >
>> > >> >> > ok, well I need to flip a few boolean values to begin the group order process.
>> > >> >>
>> > >> >> Oh, you mean that when the amount goes to zero you need to take some
>> > >> >> action?  In that case that should probably be initiated by the action
>> > >> >> that sets it zero, either directly on updating it to zero or possibly
>> > >> >> in an after filter.  Or have a background job that looks for zero and
>> > >> >> takes the appropriate action.
>> > >> >>
>> > >> >> Colin
>> > >> >
>> > >> > --
>> > >> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > >> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > >> > To post to this group, send email to [hidden email].
>> > >> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
>> > >> > For more options, visit https://groups.google.com/d/optout.
>> > >>
>> > >> --
>> > >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > >> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > >> To post to this group, send email to [hidden email].
>> > >> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
>> > >> For more options, visit https://groups.google.com/d/optout.
>> > >
>> > > --
>> > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > > To post to this group, send email to [hidden email].
>> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
>> > > For more options, visit https://groups.google.com/d/optout.
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > To post to this group, send email to [hidden email].
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > To post to this group, send email to [hidden email].
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b3d7b973-6ee6-4ca4-96e5-f40d3ff9a536%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtizfJUK0XLV2vjev_7xzd11jr5f4E2jQYJj1CvD3ecNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: updating records

Joe Guerra
Great, I've got my new scope in there.  Seems to be working well.

I've got to learn how to write tests. :)

On Sunday, August 26, 2018 at 12:52:29 PM UTC-4, Colin Law wrote:
On Sun, 26 Aug 2018 at 17:20, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="zGVyW6xZAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">JGu...@...> wrote:
>
> Yes, I know.
>
> I learned about using the default scope, then put it into my app.  Then I discovered everyone said not to use them.   lol.

Yes, default scope seems like a good idea initially, but it often end
with tears :(

Colin

>
>
>
> On Wednesday, August 22, 2018 at 8:08:53 PM UTC-4, Walter Lee Davis wrote:
>>
>>
>> > On Aug 22, 2018, at 1:28 PM, Joe Guerra <[hidden email]> wrote:
>> >
>> > I've got to fix my default scope.
>>
>> Default scopes are a serious anti-pattern, and cause more pain than they solve. I cannot think of one time I used them that I didn't regret it later.
>>
>> Walter
>>
>> >
>> > On Wed, Aug 22, 2018 at 1:23 PM, Joe Guerra <[hidden email]> wrote:
>> > ok, so I got it working...
>> >
>> > the process is add to cart ....  my show page updates quantity... and if it reached 0 now i've got it updating and redirecting to root_path.
>> >
>> > works like a charm.  (not sure if that's optimal).
>> >
>> > On Wednesday, August 22, 2018 at 12:34:02 PM UTC-4, Colin Law wrote:
>> > On Wed, 22 Aug 2018 at 17:17, Joe Guerra <[hidden email]> wrote:
>> > >
>> > > Yes, in the product controller?
>> > >
>> > > In
>> > > Def show
>> > > End
>> >
>> > That is not a page that is a controller action, which invokes a view.
>> > It is important to use the correct words or others will not know what
>> > you mean.  By page I assumed you meant the view.  But surely you are
>> > not changing the quantity in that action, I would have expected a
>> > change in quantity to be in an Update action.
>> >
>> > Colin
>> >
>> > >
>> > > On Wed, Aug 22, 2018, 12:00 PM Colin Law, <[hidden email]> wrote:
>> > >>
>> > >> On Wed, 22 Aug 2018 at 16:54, Joe Guerra <[hidden email]> wrote:
>> > >> >
>> > >> > Ok, since it's on the show page I can check for that (and it did work on that page), but as soon as it is added I think I need to redirect to another page,
>> > >>
>> > >> You shouldn't be doing it in a view at all, you should do it in the
>> > >> action or model that updates the quantity, when it sees it is zero.
>> > >>
>> > >> Colin
>> > >>
>> > >> >
>> > >> > (because I don't display items that are fully funded and i got a page not found message 404)...  I'll try it soon.  Some sort of congratulations page - "we have met the target , blah blah blah..."
>> > >> >
>> > >> > Thanks,
>> > >> > Joe
>> > >> >
>> > >> >
>> > >> > On Wednesday, August 22, 2018 at 11:46:26 AM UTC-4, Colin Law wrote:
>> > >> >>
>> > >> >> On Wed, 22 Aug 2018 at 16:31, Joe Guerra <[hidden email]> wrote:
>> > >> >> >
>> > >> >> > ok, well I need to flip a few boolean values to begin the group order process.
>> > >> >>
>> > >> >> Oh, you mean that when the amount goes to zero you need to take some
>> > >> >> action?  In that case that should probably be initiated by the action
>> > >> >> that sets it zero, either directly on updating it to zero or possibly
>> > >> >> in an after filter.  Or have a background job that looks for zero and
>> > >> >> takes the appropriate action.
>> > >> >>
>> > >> >> Colin
>> > >> >
>> > >> > --
>> > >> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > >> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> > >> > To post to this group, send email to [hidden email].
>> > >> > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/91aca44e-776b-4b8d-85da-c053b05eedbd%40googlegroups.com.
>> > >> > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>> > >>
>> > >> --
>> > >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > >> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> > >> To post to this group, send email to [hidden email].
>> > >> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvxgjsweG1RkY1UR2s0DQt5zBswyPgJMNtCffGB2zAJeg%40mail.gmail.com.
>> > >> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>> > >
>> > > --
>> > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> > > To post to this group, send email to [hidden email].
>> > > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmp1BhL1Bi8OxTbMkYunUb5KunRc6LgyKPGQpX9mfCacA%40mail.gmail.com.
>> > > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to [hidden email].
>> > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/34777de2-c556-4c20-8d6b-1f2484512dba%40googlegroups.com.
>> >
>> > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to [hidden email].
>> > To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMm-KR1Hydjif9%3D8y2nj8C4EXahmzwk8n3NRz0tJRq8m%2Bw%40mail.gmail.com.
>> > For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="zGVyW6xZAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="zGVyW6xZAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/b3d7b973-6ee6-4ca4-96e5-f40d3ff9a536%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/b3d7b973-6ee6-4ca4-96e5-f40d3ff9a536%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/b3d7b973-6ee6-4ca4-96e5-f40d3ff9a536%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/b3d7b973-6ee6-4ca4-96e5-f40d3ff9a536%40googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c00d3e10-77bd-49f3-81b8-89f0d18eee82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.