Hello There, I have a minor problem that is driving me a bit crazy and was hoping maybe someone can see something I''m not... In my view I have the following code: <p align=center> <b>Choose A Cuisine:</b> <%= collection_select(:restaurant, :cuisine_id , @cuisine, :id, :name, :prompt => ''Any'') %> </p> Now I am trying to access the selected value in my controller with the following code: @cuisineID = params[:restaurant_cuisine_id] Unfortunately @cuisineID always comes back NIL for some reason. When I check the development log I see that the param is actually being set properly: Parameters: {"restaurant"=>{"cuisine_id"=>"8"}, "search"=>"110 ros valley rd, Toronto, On, Canada", "action"=>"index", "....) If it helps, my view is for an index action and so there is no restaurant variable to set in the page. The drop down is part of a search. Thanks, Steve -- 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 -~----------~----~----~----~------~----~------~--~---
it''s: params[:restaurant][:cuisine_id] -- 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> it''s: > params[:restaurant][:cuisine_id]Thanks a lot. Appreciate the help! steve -- 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 -~----------~----~----~----~------~----~------~--~---
Hello there, I have what I think is a simple problem that I was hoping someone could help me with. I have an application that keeps track of many restaurants. Each restaurant has many user reviews associated with it. When a user does a search it will return a list of restaurants. I would like to have a "see reviews" link with each restaurant listing. Now when someone clicks on the "see reviews" link I would like to have the reviews appear instantly below the restaurant listing without a page refresh. Now the way I am doing it is by pre-loading and hiding the reviews. My partial for displaying each restaurant looks like this: <a href="#" onClick="toggleReviews()";>See Reviews</a> <div id=review style="display: none"> <% if !listing.reviews.blank? %> <%= render :partial => ''review'', :collection => listing.reviews %> <% end %> </div> Now the problem is in my toggleReviews function I need the div id of the element to toggle. If I use "review" it will show the reviews for all restaurants. Any ideas how I can dynamically set the div id to something like: "review" + listing.review.id so that I can toogle the correct one? Or is there a better way to accomplish what I am trying to do. Thanks, steve -- 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 -~----------~----~----~----~------~----~------~--~---
Long wrote:> Assuming each restaurant has a unique ID, I would do the following: > > <div id="review_for<%= restaurant.id %>" style="display: none"> > > <a href="#" onClick="toggleReviews(''review_for<%= restaurant.id %>'', > ...)";>See Reviews</a> > > -- Long > http://FATdrive.tv/wall/trakb/10-Long > http://FATdrive.tv/ - store, play, share > > > ----- Original Message ----- > From: "Steve Glaz" <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Sent: Friday, March 14, 2008 3:40 PM > Subject: [Rails] Simple ProblemThanks for the help - I think were on the right track. I was actually trying to use the following: <%= link_to_function "See Reviews", "Element.toggle(''review_for'')" %> but don''t know how to get the restaurant ID in the toggle name. I tried this <%= link_to_function "See Reviews", "Element.toggle(''review_for'' + restaurant.id)" %> and it didn''t work. Any suggestions? thanks again, steve -- 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 -~----------~----~----~----~------~----~------~--~---
Assuming each restaurant has a unique ID, I would do the following: <div id="review_for<%= restaurant.id %>" style="display: none"> <a href="#" onClick="toggleReviews(''review_for<%= restaurant.id %>'', ...)";>See Reviews</a> -- Long http://FATdrive.tv/wall/trakb/10-Long http://FATdrive.tv/ - store, play, share ----- Original Message ----- From: "Steve Glaz" <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Sent: Friday, March 14, 2008 3:40 PM Subject: [Rails] Simple Problem> > Hello there, > > I have what I think is a simple problem that I was hoping someone could > help me with. I have an application that keeps track of many > restaurants. Each restaurant has many user reviews associated with it. > When a user does a search it will return a list of restaurants. I would > like to have a "see reviews" link with each restaurant listing. > > Now when someone clicks on the "see reviews" link I would like to have > the reviews appear instantly below the restaurant listing without a page > refresh. > > Now the way I am doing it is by pre-loading and hiding the reviews. My > partial for displaying each restaurant looks like this: > > <a href="#" onClick="toggleReviews()";>See Reviews</a> > > > <div id=review style="display: none"> > > <% if !listing.reviews.blank? %> > <%= render :partial => ''review'', :collection => listing.reviews %> > <% end %> > > </div> > > Now the problem is in my toggleReviews function I need the div id of > the element to toggle. If I use "review" it will show the reviews for > all restaurants. Any ideas how I can dynamically set the div id to > something like: > > "review" + listing.review.id so that I can toogle the correct one? Or is > there a better way to accomplish what I am trying to do. > > Thanks, > steve > ----~--~---------~--~----~------------~-------~--~----~ 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 Mar 14, 2008, at 5:12 PM, Steve Glaz wrote:> Long wrote: >> Assuming each restaurant has a unique ID, I would do the following: >> >> <div id="review_for<%= restaurant.id %>" style="display: none"> >> >> <a href="#" onClick="toggleReviews(''review_for<%= restaurant.id %>'', >> ...)";>See Reviews</a> >> >> -- Long >> http://FATdrive.tv/wall/trakb/10-Long >> http://FATdrive.tv/ - store, play, share >> >> >> ----- Original Message ----- >> From: "Steve Glaz" <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> >> To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> Sent: Friday, March 14, 2008 3:40 PM >> Subject: [Rails] Simple Problem > > Thanks for the help - I think were on the right track. I was actually > trying to use the following: > > <%= link_to_function "See Reviews", "Element.toggle(''review_for'')" %> > > but don''t know how to get the restaurant ID in the toggle name. I > tried > this > > <%= link_to_function "See Reviews", "Element.toggle(''review_for'' + > restaurant.id)" %> > > and it didn''t work. Any suggestions? > > thanks again, > steve<%= link_to_function "See Reviews", "Element.toggle(''review_for#{restaurant.id}'')" %> -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn wrote:> > <%= link_to_function "See Reviews", > "Element.toggle(''review_for#{restaurant.id}'')" %> > >Good suggestion Rob! That should work if the DIV id is set accordingly. Long --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi there, I am building an application that stores the delivery boundaries of businesses. I have a separate table called boundaries that has fields for the latitude and longitude. Each business can have many of these boundary points and I use google maps with markers to capture the information. No my problem is this - when a user wishes to edit a business I need to display the delivery area in a google maps using a javascript function. How can I pass the list of boundaries associated with the business to a javascript function? Thanks, steve -- 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 Wed, Mar 26, 2008 at 06:20:04PM +0100, Steve Glaz wrote:> I am building an application that stores the delivery boundaries of > businesses. I have a separate table called boundaries that has fields > for the latitude and longitude. Each business can have many of these > boundary points and I use google maps with markers to capture the > information. > > No my problem is this - when a user wishes to edit a business I need to > display the delivery area in a google maps using a javascript function. > How can I pass the list of boundaries associated with the business to a > javascript function?You''ll have a script tag in your view. Here''s some rough pseudocode: <script type="text/javascript"> var old_boundaries = <%= @business.boundaries.map { |b| [ b.latitude, b.longitude ] }.to_json %>; </script> Your JS code can now refer to old_boundaries for the set of points.> Thanks, > steve--Greg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi there, I have a simple search application where a user types in there address and I return a list. I have a radio button and a drop down where the user can narrow down the search. The problem is that after the search form is submitted and the page redisplays both the drop down value and radio button return to there original values rather then the ones chosen by the user. How can I go about keeping these values? Here is my view code... <TD><%= text_field_tag :search, params[:search], :size => 50 %></TD> <TD><%= collection_select(:restaurant, :cuisine_id ,Cuisine.find(:all), :id, :name, :prompt => "Don''t Care") %></TD> <TD><%= submit_tag "Who Delivers?", :name => nil %> </TD> </TR> <TR> <TD><input type="checkbox" name="checkopen">Open Now</TD> Thanks, steve -- 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 -~----------~----~----~----~------~----~------~--~---
> I have a simple search application where a user types in there address > and I return a list. I have a radio button and a drop down where the > user can narrow down the search. The problem is that after the search > form is submitted and the page redisplays both the drop down value and > radio button return to there original values rather then the ones chosen > by the user. How can I go about keeping these values? Here is my view > code... > > <TD><%= text_field_tag :search, params[:search], :size => 50 %></TD> > <TD><%= collection_select(:restaurant, :cuisine_id > ,Cuisine.find(:all), :id, :name, :prompt => "Don''t Care") %></TD> > <TD><%= submit_tag "Who Delivers?", :name => nil %> </TD> > </TR> > <TR> > <TD><input type="checkbox" name="checkopen">Open Now</TD><%= check_box_tag ''checkopen'', 1, params[:checkopen] == ''1'' %> Something similar for collection_select...> > > Thanks, > steve > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thanks Philip...worked like a charm. steve Philip Hallstrom wrote:>> ,Cuisine.find(:all), :id, :name, :prompt => "Don''t Care") %></TD> >> <TD><%= submit_tag "Who Delivers?", :name => nil %> </TD> >> </TR> >> <TR> >> <TD><input type="checkbox" name="checkopen">Open Now</TD> > > <%= check_box_tag ''checkopen'', 1, params[:checkopen] == ''1'' %> > > Something similar for collection_select...-- 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 -~----------~----~----~----~------~----~------~--~---
Is there a collection_select_tag option? I can''t seem to find it? steve Philip Hallstrom wrote:>> ,Cuisine.find(:all), :id, :name, :prompt => "Don''t Care") %></TD> >> <TD><%= submit_tag "Who Delivers?", :name => nil %> </TD> >> </TR> >> <TR> >> <TD><input type="checkbox" name="checkopen">Open Now</TD> > > <%= check_box_tag ''checkopen'', 1, params[:checkopen] == ''1'' %> > > Something similar for collection_select...-- 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 -~----------~----~----~----~------~----~------~--~---