to overwrite spree javascripts, such as spree.js.coffee.erb,
first , enable assets path in config/application.rb
add:
config.assets.paths << "#{Rails.root}/assets"
Next, copy the assets file to the same directory path as the assets on spree.
eg.
spree / core / app / assets / javascripts / spree.js.coffee.erb
to:
assets/javascripts/spree.js.coffee.erb
Then run this on server, if its in production mode:
bundle exec rake tmp:clear
then restart the server,
thin restart, or what ever server you are using. you may stop and start.
if you need to add more file, you may edit:
vendor/assets/javascripts/spree/frontend (or backend) / all.js
hope it helps :)
Friday, September 12, 2014
Sunday, August 24, 2014
Marionette compositeView changed itemView to childView!
it was changed, and nobody was notified,
not that i could google until i found its not working...
terrible community update
not that i could google until i found its not working...
terrible community update
Labels:
backbone,
backbone js,
itemView,
javascript,
marionette
Thursday, July 24, 2014
undefined method ... path due to polymorphic_url
i came across this non meaningful error,
as it turn out to be a mis named params
example: mispelled params[:nam] for params[:name]
as it turn out to be a mis named params
example: mispelled params[:nam] for params[:name]
Friday, July 18, 2014
ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds)
it turn out there could be 2 reasons,
1. rails connection pool have reached and there might be zombie connection
2. mysql max_connections / max_user_connections may have reached
in most cases, its the first possibility.
ensure that you have set the connection pool to a much higher value,
1. rails connection pool have reached and there might be zombie connection
2. mysql max_connections / max_user_connections may have reached
in most cases, its the first possibility.
ensure that you have set the connection pool to a much higher value,
to handle enough concurrent users at the same time
production:
adapter: mysql2
pool: 100
2nd issue is due to zombie connection which may lead filling up pool with undead connections.
add a config/initializers/db_connections.rb
with these code:
-----------------
Rails.application.config.after_initialize do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = ActiveRecord::Base.configurations[Rails.env] ||
Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds
#config['pool'] = ENV['DB_POOL'] || ENV['MAX_THREADS'] || 5
puts "pool size: "+config['pool'].to_s
ActiveRecord::Base.establish_connection(config)
end
end
-----------------
these should hopefully handle undead issue for db connections.
another fix is possible to fix network connection bug when writing to a disconnected connection.
------------------
response.stream.write data
#workaround hang stream due to client dc halfway: https://gist.github.com/njakobsen/6257887
sleep 0.0001
-------------------
to check number of active connections for a database,
run rails dbconsole# (makesure you have set RAILS_ENV to the correct environment)
#and:
to check number of active connections for a database,
run rails dbconsole# (makesure you have set RAILS_ENV to the correct environment)
#and:
SHOW FULL PROCESSLIST;
thanks to these articles:
Wednesday, July 16, 2014
Wednesday, June 25, 2014
Circular dependency detected while autoloading constant
When face upon this issue,
its caused by naming controller or calling model name incorrectly.
possible issue are naming are case sensitive.
example:
#model
class Oi
end
But calling
OI.find #this lead to circular dependency error
its caused by naming controller or calling model name incorrectly.
possible issue are naming are case sensitive.
example:
#model
class Oi
end
But calling
OI.find #this lead to circular dependency error
Subscribe to:
Posts (Atom)