On Wed, Feb 15, 2012 at 8:37 AM, Bruno Meira <[email protected]> wrote:

> Hi Javier,
> I think that this approach is correct but I guess that if you use
> transaction it will be better for your system performance.
> :D
>
>
For example when I want to add several items using checkboxes I add it by
doing this

Model.another_model_ids = params[:ids]
(Product.category_ids = params[:ids]) for example

or  just by doing

Model.another_models << AnotherModel.find(params[:id])

I saw the first one on a railscast and it seems to work when adding, but
I've never done something like deleting several items

Maybe my approach is incorrect :)

I'm kind of new on rails and... I've never used transactions, you mean this?
http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html

Javier Q.

-- 
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 this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to