I want to load jQuery UI via Google CDN if in production and locally if in development. So in my application.html.erb layout, I've got to know whether I'm in production or dev. Is there a variable I can check?
To expand a bit on Paritosh's answer, Rails.env.production? and Rails.env.development? will return true/false depending on which environment you're using.
These methods are defined in the StringInquirer class in the ActiveSupport module. See them here.
I am trying to precompile assets using the command rake assets:precompile RAILS_ENV=production, but I always get the error below.
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/bin/ruby /usr/bin/rake assets:precompile:all RAILS_…
I have a link that I need to submit a post request with. Normally, I'd use jQuery and prevent the link's default behavior and then submit a form to the destination. This seems like something Rails should be able to …
I have the following code in a Rails controller:
flash.now[:notice] = 'Successfully checked in'
redirect_to check_in_path
Then in the /check_in view:
<p id="notice"><%= notice %></p>
However, the notice …