Tuesday, February 22, 2011

[Rails] Re: Can't get .js.erb to work ...

:)

I moved the file to /views/javascripts/getlocation.js.erb
But there must be something wrong with routes or something else
still.

If i go to: http://localhost:3000/javascripts/getlocation.js i get a
No route matches "/javascripts/getlocation.js" error.

[Routes]
ModcubeApp::Application.routes.draw do

get "log_in" => "sessions#new", :as => "log_in"
get "sign_up" => "accounts#new", :as => "sign_up"
root :to => "pages#home"

resources :accounts

match ":controller(/:action(/:id(.:format)))"

end

[javascripts_controller.rb]
class JavascriptsController < ApplicationController

def getlocation
@states = State.find(:all)
@citys = City.find(:all)
end

end

//Niklas


On 22 Feb, 20:25, Hassan Schroeder <hassan.schroe...@gmail.com> wrote:
> On Tue, Feb 22, 2011 at 10:51 AM, Niklas Nson <niklasn...@meantime.se> wrote:
> > Yes i also belive that it dosent fire up. If i go to :
> >http://localhost:3000/javascripts/location_handler.js
>
> Oops. That's the problem -- files under public are static, that is, *not*
> interpreted. You need to put your file somewhere within app/views.
>
> --
> Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
> twitter: @hassan

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate