Hi!

On Tue, Nov 20, 2012 at 4:53 PM, Werner <[email protected]>wrote:

> Hi jim
>
> As I am using remote: true I created a update.js.erb and a respond_to do
> |format| block.
> Copied the format html ocde into the update.js.erb and the update process
> is still working.. so far so good.
>
> But it is unclear to me how to update the
> Model.where(model_id: id).sum("attribute") query  which is in edit action.
>

Can you paste in part of the edit template where you use the result of this
query?


> Using html, after update the edit action is called and the query is
> refreshed. How to get this working with js?
> Something like a submit or refreshing the edit action..?
>

Can you also paste your edit and update actions so we can work on the code
level.


>
> Thanks for sharing..


>
>
>
>
> Am Montag, 19. November 2012 15:30:42 UTC+1 schrieb jim:
>>
>>
>>
>>
>> On Mon, Nov 19, 2012 at 10:25 PM, Werner <webagent...@googlemail.**com>wrote:
>>
>>> On my edit page I can update values using ajax.
>>>
>>> In my edit action I also have something like: Model.where(model_id:
>>> id).sum("attribute")
>>> As the edit action is not executed anymore, I dont get a proper result
>>> after I add some new value, have to reload the page.
>>>
>>> How is the best way to actualize the sum after edit.. ?
>>>
>>
>> Are you updating the values by calling $.ajax or just passing in remote:
>> true on your forms?
>>
>> If you use $.ajax, I suggest that you pass in the sum as json which
>> $.ajax can process.  If you're
>> using remote: true, you can create an update.js.erb or update.js.haml
>> which will be rendered
>> after you update.
>>
>>
>>>
>>> Thanks
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ruby on Rails: Talk" group.
>>> To post to this group, send email to rubyonra...@googlegroups.**com.
>>> To unsubscribe from this group, send email to rubyonrails-ta...@**
>>> googlegroups.com.
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/rubyonrails-talk/-/**RHAW38e5gOwJ<https://groups.google.com/d/msg/rubyonrails-talk/-/RHAW38e5gOwJ>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> ------------------------------**------------------------------**-
>> visit my blog at http://jimlabs.heroku.com
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/GktAGfGYQm4J.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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 https://groups.google.com/groups/opt_out.


Reply via email to