3

I want to load jQuery from http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js regularly, in production/development environment, as long as I'm not running locally, but my own local jquery.min.js if running locally (e.g. 0.0.0.0:3000)

Reason why is that I have to do some development without internet connection sometimes, mostly when riding the subway.

I've been doing a if RAILS_ENV == 'development' conditional in the template, but it's annoying to have to change the template every time I need to force 'production' mode locally.

I'm using haml btw.. not that it really matters.

What's the best way to do this? Thanks

1 Answer 1

2

ActionController has a method local_request?. You will probably have to declare it as a helper_method to be able to use it in your views:

class ApplicationController < ActionController::Base
    helper_method :local_request?
    ...
end
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.