On 8 May 2012 19:22, Marcelo G. Silva
<mgswolf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Well folks let me try to explain my problem.
> I have a database of musics and each music can have multiple
> artists through other table/model in the case Performers.
> I would like to record music in new/edit add
> artists and select them via a combo-box, used a
> simple collection_select, and used to add a new one a UJS
> i see on Railscasts.
> In the testing phase with few records everything was fine, but I have
> a legacy database table where the artists have 62k records.
> Well .. sure takes 18s to execute the query and render the
> page. and if I try to add a new artist with javascript
> app dies.
>
Unless I''m missing something you have a line
<%= f.collection_select :artist_id, Artist.find_ordened_artists, :id, :name
,:prompt => ''Selecionar Artista'' %>
that is rendering all 62,000 records...
That''s just not going to work. Not only will it likely overload
everything,
it''s also unusable for a user to browse through.
You''ll want to look at doing an AJAX autocomplete box or similar.
> I tried to use fragment caching to the select this did not work.
> I also tried using memcached, it is limited to 1M, and my
> query takes 5M, removed this limit and yet the system continues
> crashing when I add the javascript.
> my knowledge (almost none) to prevent me from creating javascript
> Another method of adding artists.
> I do not know if there is a way to improve performance through caching
> or
> whether it is design problem.
> The environment is: Ruby 1.9.3, Rails 2.3.3, MySQL 5.5
> if someone could understand my problem and it is with great humor can
> look at this code snippet
> gist.github.com/2637961
> Since already thank you very much.
>
> --
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
groups.google.com/group/rubyonrails-talk?hl=en.