hi.. I use auto_complete... put this in my controllerBestemming: auto_complete_for :bestemming, :naam This works fine... But when i make a action in controllerBestemming, below...it does nothing.... def auto_complete_for_bestemming_naam @bestemmingen = Bestemming.find(:all, :conditions => [ ''LOWER(naam) LIKE ?'', ''%'' + request.raw_post.downcase + ''%'' ]) render :inline => "<%= auto_complete_result(@bestemmingen, ''naam'') %>" end What i am doing wrong? grtz..remco -- Posted via http://www.ruby-forum.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Perhaps due to the protect_from_forgery line in your application.rb file. Try commenting this out and see if it works, if you don''t care about people forging your forms :) On Mon, May 19, 2008 at 9:30 PM, Remco Zwaan < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > hi.. > > I use auto_complete... > > put this in my controllerBestemming: > > auto_complete_for :bestemming, :naam > > This works fine... > > But when i make a action in controllerBestemming, below...it does > nothing.... > > > def auto_complete_for_bestemming_naam > @bestemmingen = Bestemming.find(:all, > :conditions => [ ''LOWER(naam) LIKE ?'', > ''%'' + request.raw_post.downcase + ''%'' ]) > render :inline => "<%= auto_complete_result(@bestemmingen, ''naam'') > %>" > end > > What i am doing wrong? > > grtz..remco > -- > Posted via http://www.ruby-forum.com/. > > > >-- Appreciated my help? Reccommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Perhaps due to the protect_from_forgery line in your application.rb > file. > Try commenting this out and see if it works, if you don''t care about > people > forging your forms :) > > On Mon, May 19, 2008 at 9:30 PM, Remco Zwaan < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> end >> >> What i am doing wrong? >> >> grtz..remco >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Appreciated my help? > Reccommend me on Working With Rails > http://workingwithrails.com/person/11030-ryan-biggHi..this works.. def auto_complete_for_bestemming_naam bestemming_search = params[:bestemming][:naam] @bestemmingen = Bestemming.find(:all, :conditions => [ ''LOWER(naam) LIKE ?'', bestemming_search.downcase + ''%'' ], :order => ''naam ASC'') render :partial => ''autocomplete'' end _autocomplete.rhtml <%= auto_complete_result(@bestemmingen, ''naam'') %> Bu when i change _autocomplete.rhtml to <% for bestemming in @bestemmingen -%> <%= bestemmingen.naam %></li> <% end -%> I doesn''t work...anymore.... Must i use the helper "auto_complete_result" or is my partial-code not good? remco -- Posted via http://www.ruby-forum.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 19 May 2008, at 15:02, Remco Zwaan wrote:> def auto_complete_for_bestemming_naam > bestemming_search = params[:bestemming][:naam] > @bestemmingen = Bestemming.find(:all, > :conditions => [ ''LOWER(naam) LIKE ?'', > bestemming_search.downcase + ''%'' ], > :order => ''naam ASC'') > render :partial => ''autocomplete'' > end > > _autocomplete.rhtml > > <%= auto_complete_result(@bestemmingen, ''naam'') %> > > Bu when i change _autocomplete.rhtml to > > <% for bestemming in @bestemmingen -%> > <%= bestemmingen.naam %></li> > <% end -%>Well, you''re using a non-existent local variable "bestemmingen" instead of "bestemming" as you named it in the first line.> I doesn''t work...anymore.... > > Must i use the helper "auto_complete_result" or is my partial-code not > good?Also remember that Rails as a framework uses English as its main language, you''ll run into problems sooner or later because the singular/plural inflectors can never do their job well. Even if you would like to make your urls make sense to a Dutch-speaking person, you could still use English controller names, English named models and fields and just adjust your routes file to hide the default English name and replace it with the Dutch version. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt wrote:> On 19 May 2008, at 15:02, Remco Zwaan wrote: > >> >> <%= auto_complete_result(@bestemmingen, ''naam'') %> >> >> Bu when i change _autocomplete.rhtml to >> >> <% for bestemming in @bestemmingen -%> >> <%= bestemmingen.naam %></li> >> <% end -%> > > Well, you''re using a non-existent local variable "bestemmingen" > instead of "bestemming" as you named it in the first line. > >> I doesn''t work...anymore.... >> >> Must i use the helper "auto_complete_result" or is my partial-code not >> good? > > Also remember that Rails as a framework uses English as its main > language, you''ll run into problems sooner or later because the > singular/plural inflectors can never do their job well. Even if you > would like to make your urls make sense to a Dutch-speaking person, > you could still use English controller names, English named models and > fields and just adjust your routes file to hide the default English > name and replace it with the Dutch version. > > > Best regards > > Peter De Berdthi Peter... Do you have some url''s with some documentation how i can realize dutch-language urls with english models/controllers.. remco -- Posted via http://www.ruby-forum.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 19 May 2008, at 15:29, Remco Zwaan wrote:> Do you have some url''s with some documentation how i can realize > dutch-language urls with english models/controllers..Your models shouldn''t be a problem at all, since the MVC model implies that your user will never see model names throughout the application. If you want your field names to be translated, you can use simple_localization (http://simple-localization.arkanis.de/), which I prefer over Globalize. It will allow you to map the fieldnames to the translation. Using your "bestemmingen" example, something like this should work: map.resources :destinations, :as => ''bestemmingen'', :singular => ''bestemming'' That is assuming that you use the RESTful conventions. All of this should be right there in the Rails API somewhere. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt wrote:> On 19 May 2008, at 15:29, Remco Zwaan wrote: > >> Do you have some url''s with some documentation how i can realize >> dutch-language urls with english models/controllers.. > > Your models shouldn''t be a problem at all, since the MVC model implies > that your user will never see model names throughout the application. > If you want your field names to be translated, you can use > simple_localization (http://simple-localization.arkanis.de/), which I > prefer over Globalize. It will allow you to map the fieldnames to the > translation. > > Using your "bestemmingen" example, something like this should work: > map.resources :destinations, :as => ''bestemmingen'', :singular => > ''bestemming'' > > That is assuming that you use the RESTful conventions. > > All of this should be right there in the Rails API somewhere. > > > Best regards > > Peter De Berdthi Peter.. Thanks for you''re reply. i am going to check the url.... Groet, remco -- Posted via http://www.ruby-forum.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you want to keep your Dutch model names, you can define your pluralization rules globally in /config/initializers/inflections.rb (Rails 1: config/environment.rb), like this: Inflector.inflections do |inflect| inflect.plural /([aeou])+([^aeiouy])$/i, ''\1\2en'' inflect.singular /([aeou])([^aeiouy])en$/i, ''\1\1\2'' inflect.plural /([^aeiouy])$/i, ''\1en'' inflect.singular /([^aeiouy])en$/i, ''\1'' end or if you''re not good at regexen, just do it per model name: Inflector.inflections do |inflect| inflect.irregular ''land'', ''landen'' ... and you can check them in irb with: ''naam''.pluralize #=> ''namen'' ''namen''.singularize #=> ''naam'' ''land''.pluralize #=> ''landen'' ''landen''.singularize #=> ''land'' For anything that doesn''t match your custom rules, the default English rules are used. But it''s tricky. I''ve tried it for German, kept running into errors and ended up refactoring to English table names. Dutch plurals are simpler, so it could work for you. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---