Glyphicon Works Locally But Not on Heroku

Glyphicon works locally but not on Heroku

The solution was to change config.assets.compile = false to config.assets.compile = true in the config/environments/production.rb file.

Bootstrap drowdown works locally but not in heroku

you need to have all 4 of these:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .

Controller works fine locally but not on heroku

The issue is that since you've nested images under properties, you'll have to declare both @instance variables if you want to get the form_for to work:

def new
@property = Property.find params[:property_id]
@image = Image.new
end

Of course, you do this already.

The problem, then, is that your Property with an id of 1 doesn't exist on your Production environment. You need to make sure you're handling your data-set with the same care as you would development (evaluating if dependent objects don't exist):

def new
@property = Property.find params[:property_id]
if @property
@image = @property.images.new
else
redirect_to root_path, notice: "No Property"
end
end

You'll also want to define multiple resources at once in your routes (to clean it up):

#config/routes.rb
resources :surroundings, :headings, :options, :categories, :mains
resources :properties do
resources :images, only: [:index, :new, :create, :destroy] do
get 'update_main', on: :collection
end
get :addoption
post :postoption
end

resources :search, path: "", only: [] do
get :main, on: :collection
end

root 'search#main'

Update

The solution was trivial, the OP left a photos_controller.rb file with class ImagesController < ApplicationController declaration. Removing this file fixed the issue.

Model scope works locally but not on Heroku

This is working for you locally because your local webserver reloads all classes every time you refresh a page. In production (heroku env) this obviously will not happen for performance reasons. Classes are loaded just once, at app startup. So whatever time was at that moment, it will define which set of scopes is created.

I suggest rewriting your scopes like this (move time check into scopes themselves):

scope :upcoming, lambda { 
diff = Time.now.hour < 4 ? 0 : 1
between(Date.tomorrow+diff.day, Date.tomorrow+(4 + diff).days)
}

twitter-bootstrap icons do not appear in heroku

I solved the problem by downloading icon images directly from glyphicons.com, putting them into app/assets/images, setting config.serve_static_assets to true, running rake assets:precompile, and pushing to heroku.



Related Topics



Leave a reply



Submit