Hi there, I''ve done this before many times. But for some reason, my controller isn''t rendering my RJS file. Here''s the setup: In the View: - a call to remote_function: [code] <select name="state" onchange="<%remote_function(:url=>{:action=>:cities})%>"> [/code] In the Controller: - get the data that I need: [code] def cities @cities = Store.find_by_sql("select DISTINCT city from stores where state=''#{params[:state]}''") end [/code] I have a file called cities.rjs. However, when I run it, I get the following error: [code] ActionView::MissingTemplate (Missing template stores/cities.erb in view path app/views:vendor/plugins/easy-fckeditor/app/views): [/code] I''ve tried creating a file called cities.erb, but that doesn''t work either. The path is correct: I have the /views/stores folder there and the file is where it''s supposedly looking. I can''t fathom what the issue is here. Any help? Thanks, Aaron. -- Posted via http://www.ruby-forum.com/.
Hi Aaron, On Tue, 2009-09-22 at 20:00 +0200, Aaron Vegh wrote: I think you need to tell Rails what view template to use.> def citiesrespond_to do |format| format.js { @cities = Store.find_by ... } end> endPretty sure this will pick up the .rjs template. HTH, Bill
Try renaming cities.rjs to cities.js.rjs. Rails is smart enough to know that it''s getting a JS request, so there''s no need to tell Rails to what template to use as long as the controller method and view template follow the standard naming convention. Tim On Tue, Sep 22, 2009 at 5:36 PM, bill walton <bwalton.im-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi Aaron, > On Tue, 2009-09-22 at 20:00 +0200, Aaron Vegh wrote: > > I think you need to tell Rails what view template to use. > > > def cities > respond_to do |format| > format.js { @cities = Store.find_by ... } > end > > end > > Pretty sure this will pick up the .rjs template. > > HTH, > Bill > > > > >-- Tim Lowrimore Coroutine LLC 516 Tennessee St., Suite 215 Memphis, TN 38103 office: 901.312.8818 mobile: 901.490.5325 http://www.coroutine.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 -~----------~----~----~----~------~----~------~--~---
Hi again, Bah, turns out I had the right files in the wrong folder. I have an admin/stores folder and a plain old stores folder, and my partials and RJS were in the admin version Stupid! Thanks, Aaron. -- Posted via http://www.ruby-forum.com/.