- Login to the server ssh user@ip
- Find access.log and error.log (Present in /var/log folder in my case or use the command "locate error.log" and "locate access.log" to search for the file)
- cd /var/log
- sudo rm yourwebsite.com-access.log
- sudo rm yourwebsite.com-error.log
- Restart using the command sudo service httpd restart
- Next restart servers (touch tmp/restart.txt)
Ruby on Rails Issues, Blog, Discussions
Discussions related to web development using Ruby on Rails
Friday, July 31, 2015
Ruby on Rails - How to clear apache logs from server
Thursday, July 2, 2015
Error intalling node package manager npm before trying to install bower
Article written by Ganesh Prasad
Senior RoR Developer
Before installing Bower, which is a JavaScript command-line application, we need to setup npm (Node Package Manager)
If you already have old version installed then installing bower will throw following errors.
npm install -g bower
npm http GET http://registry.npmjs.org/bower
npm http 304 http://registry.npmjs.org/bower
npm ERR! Error: No compatible version found: bower
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR!
npm ERR! or use
npm ERR! reportbug --attach /home/ganesh/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-53-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/ganesh
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bower
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ganesh/npm-debug.log
npm not ok
If you already have old version installed then installing bower will throw following errors.
npm install -g bower
npm http GET http://registry.npmjs.org/bower
npm http 304 http://registry.npmjs.org/bower
npm ERR! Error: No compatible version found: bower
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR!
npm ERR! or use
npm ERR! reportbug --attach /home/ganesh/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-53-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/ganesh
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bower
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ganesh/npm-debug.log
npm not ok
Solution:
1) To fix the issue first uninstall the older version of npm (nodejs) packages that are already installed using the following command
sudo apt-get purge nodejs npm
2) Next install node js using the following command.
curl -L https://raw.github.com/midnightcodr/rpi_node_install/master/setup.sh | bash -s 0.10.24
3) Now that you have installed node js successfully, then install npm using the following command.
sudo apt-get install npm
4) Next you can install bower with the help of npm using the following command.
sudo npm install -g bower
Friday, March 21, 2014
Paperclip gem amazon s3 path .exists? throwing timeout error
Faced an issue where amazon s3 path was showing correctly but then when we try object.image.exists? then it threw
AWS::S3::Errors::RequestTimeout error
The issue got fixed after paperclip gem was upgraded to version 3.0.2
Reference links:
https://github.com/thoughtbot/paperclip/issues/751
Wednesday, March 5, 2014
Devise redirect to another subdomain without login
Devise gem redirect to another subdomain without login
Set the domain in initializers/session_store.rb
For example.
App::Application.config.session_store :cookie_store, key: '_play_cricket_session', domain: ".lvh.me"
App::Application.config.session_store :cookie_store, key: '_play_cricket_session', domain: ".website.com"
Set the domain in initializers/session_store.rb
For example.
App::Application.config.session_store :cookie_store, key: '_play_cricket_session', domain: ".lvh.me"
App::Application.config.session_store :cookie_store, key: '_play_cricket_session', domain: ".website.com"
Tuesday, April 16, 2013
Combining many rake tasks into one
namespace :playcricket do
desc 'build legacy data to new'
task :rebuild_database => ["playcricket:sample1", "playcricket:sample2", "playcricket:sample3"]
desc "first sample task"
task :sample1 => :environment do
puts "sample1 executed"
end
desc "second sample task"
task :sample2 => :environment do
puts "sample2 executed"
end
desc "call another rake task with arguments"
task :sample3 => :environment do
puts "sample3 executed"
Rake::Task["playcricket:sample4"].invoke("333")
end
desc "rake task with argument"
# => sample rake playcricket:sample4["767"]
task :sample4, [:sg_group_id] => :environment do |t, args|
puts "Migrating Data"
puts args[:sg_group_id]
end
end
desc 'build legacy data to new'
task :rebuild_database => ["playcricket:sample1", "playcricket:sample2", "playcricket:sample3"]
desc "first sample task"
task :sample1 => :environment do
puts "sample1 executed"
end
desc "second sample task"
task :sample2 => :environment do
puts "sample2 executed"
end
desc "call another rake task with arguments"
task :sample3 => :environment do
puts "sample3 executed"
Rake::Task["playcricket:sample4"].invoke("333")
end
desc "rake task with argument"
# => sample rake playcricket:sample4["767"]
task :sample4, [:sg_group_id] => :environment do |t, args|
puts "Migrating Data"
puts args[:sg_group_id]
end
end
Monday, March 18, 2013
Setting up gem aws-sdk to send emails
1) Firstly add add gem 'aws-sdk', '1.7.0' into your Gemfile
2) Create aws.rb inside initializers and then add valid amazon access key id and secret key as shown below. (aws.rb)
AWS.config(access_key_id: ENV['ACCESS_KEY_ID'], secret_access_key: ENV['SECRET_ACCESS_KEY'])
3) Add the Setup ACCESS_KEY_ID and SECRET_ACCESS_KEY into your application.yml file
default: &default
access_key_id: 'your acces key id'
secret_access_key: 'your secret access key'
development:
<<: *default
production:
access_key_id: 'your acces key id'
secret_access_key: 'your secret access key'
test:
<<: *default
4) To setup the feature in production mode add the following into your environments/production.rb
config.action_mailer.delivery_method = :amazon_ses
5) To setup in development mode add the following into your environments/development.rb
config.action_mailer.delivery_method = :amazon_ses
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
6) TO fix the following error (sample)
AWS::SimpleEmailService::Errors::MessageRejected in SessionsController#forgot_password
Email address is not verified.
7) Run the following command in console to verify
a) ses = AWS::SimpleEmailService.new(access_key_id: 'your access key', secret_access_key: 'you secret access key')
b) ses.identities.verify('email@yourdomain.com'). This is the same from email which you set while sending email. Once you run this command you will receive an email from amazon
Amazon SES Address Verificati on Request
One you approve your email then your email feature will start working.
Tuesday, February 5, 2013
Wednesday, May 30, 2012
Tuesday, May 29, 2012
Rails 3 jquery_ujs - link_to :remote triggers two ajax calls on click
Issue: link_to :remote triggers two ajax calls on click in rails 3+
Solution: Make sure you have not included //= require jquery_ujs in the application.js file in assets since jquery-rails already handles this in rails 3.1
courtesy: link
Solution: Make sure you have not included //= require jquery_ujs in the application.js file in assets since jquery-rails already handles this in rails 3.1
courtesy: link
Rails 3 - Installing pg with native extensions
Installing pg (0.13.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
Solution:
sudo apt-get install libpq-dev
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
Solution:
sudo apt-get install libpq-dev
Tuesday, May 15, 2012
Invalid CSS issue on RAILS_ENV=production bundle exec rake --trace assets:precompile
1)Remove all the requires in app/assets/application.css file
2)Now add config.assets.precompile = ['*.css'] in application.rb file
3)Now run RAILS_ENV=production bundle exec rake --trace assets:precompile which will help to trace the exact files where the css issue exist and then fix all the issues mentioned in the css files
4) When all the css issues are fixed then remove config.assets.precompile = ['*.css'] and then revert any requires in your application.css which was present earlier and run the RAILS_ENV=production bundle exec rake --trace assets:precompile again. This should fix the issue.
2)Now add config.assets.precompile = ['*.css'] in application.rb file
3)Now run RAILS_ENV=production bundle exec rake --trace assets:precompile which will help to trace the exact files where the css issue exist and then fix all the issues mentioned in the css files
4) When all the css issues are fixed then remove config.assets.precompile = ['*.css'] and then revert any requires in your application.css which was present earlier and run the RAILS_ENV=production bundle exec rake --trace assets:precompile again. This should fix the issue.
Connecting datacard on Ubuntu 11
1) Go to -Dash home >> Network Connections
2) Select Mobile Broadband and click on "Add"
3) Select your mobile connection in dropdown >> "Continue"
4) Select your country and click on "Continue"
4) Select your service provide and click on "Continue"
5) Select your plan and click on "Apply" >> "Save"
2) Select Mobile Broadband and click on "Add"
3) Select your mobile connection in dropdown >> "Continue"
4) Select your country and click on "Continue"
4) Select your service provide and click on "Continue"
5) Select your plan and click on "Apply" >> "Save"
Subscribe to:
Posts (Atom)