Author Archives: www.klairvoyant.in

community engine, S3, Heroku

1) clone the source code from https://github.com/bborn/ce-heroku 2) build and deploye to heroku 3) add addon sendgrid to your application 4)made necessary changes in application_config.rb example :app_host => ‘your hostname’, :community_name => “your community name”, :s3_credentials => { :access_key_id => … Continue reading

Posted in ruby on rails | Tagged , , , , , , | Leave a comment

Refinery Hosting on Heroku

Prerequisites 1) The Ruby language version 1.9.3 or higher 2) A working installation of ImageMagick 1) create a gemset using RVM rvm use –create ruby-1.9.3@refinery 2)Installing Refinery gem install refinerycms 3) Creating a Refinery application refinerycms mycms 4) Starting up … Continue reading

Posted in ruby on rails, web development | Tagged , , , , , , , | Leave a comment

configure S3 in spree, Heroku

1) add gem ‘aws-sdk’ and then bundle install. add to spree.rb located at config/intializers/spree.rb. you don’t want to change anything in this code attachment_config = { s3_credentials: { access_key_id: ENV[‘AWS_ACCESS_KEY_ID’], secret_access_key: ENV[‘AWS_SECRET_ACCESS_KEY’], bucket: ENV[‘S3_BUCKET_NAME’] }, storage: :s3, s3_headers: { “Cache-Control” … Continue reading

Posted in ecommerce, web development | Tagged , , , , , , | Leave a comment

heroku add second email

create new public/private key for new email as follows 1) ssh-keygen -t rsa -C “mvjohn@klairvoynat.com” 2) provide new file name in which to save the key (/home/.ssh/seckey) 3) Then add your new key to the ssh-agent:- ssh-add ~/.ssh/seckey 4) Then … Continue reading

Posted in ROR, Ruby, ruby on rails, web development | Tagged , | Leave a comment

Ruby Tips

Inject http://blog.flvorful.com/2010/01/24/a-simple-pattern-for-rubys-inject-method http://stackoverflow.com/questions/3455627/how-does-this-ruby-injection-magic-work Exclamation marks (!) with functions In general, methods that end in ! indicate that the method will modify the object it’s called on. Ruby calls these “dangerous methods” because they change state that someone else might have … Continue reading

Posted in Ruby | Tagged | Leave a comment

RSpec – doubles stub and mock

doubles when we depend on components with nondeterministic characteristics, we may find that files get corrupted, disk fail, networks time out, and servers go down in the middle of running specs. because these are things that we have no control … Continue reading

Posted in rails, ROR, ruby on rails, testing, web development | Tagged , , , , , | Leave a comment

Heroku application- increase performance – Tips and Tools

1) use unicorn 2) Using Amazon CloudFront CDN with Rails 3) enable gzip compression 4) Use the following browser plugins to check performance issues a) FireBug b) page speed insights 5) Optimize Images for the Web ( http://luci.criosweb.ro/riot/ ) it’s … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , | 1 Comment

Bootstrap 3 with Rails 4

Refer the blog http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/ In the downloaded bootstrap archive you will see a ‘dist’ folder which will house the css, javascripts, and fonts folders we will want to copy to our Rails application vendor/assets/ directory. bootstrap/dist/css/bootstrap.css and bootstrap/dist/css/bootstrap.min.css to vendor/assets/stylesheets … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , | Leave a comment

Custom rake task

Task to add Indian states to spree database. 1) Add a text file with extension .rake to the folder lib/tasks/ example:-lib/tasks/mytask.rake 2) add file content as follows task :add_indian_states=>:environment do CSV.foreach(“lib/tasks/states.csv”) do | row | state, abbr = row Spree::State.create(:name … Continue reading

Posted in rails, ruby on rails, web development | Tagged , , , , , | 5 Comments

Rails API

1) follow  railcast no:-348 In /public/index.html file use function addTask as the following way instead of described function addTask(ta) { $(‘#tasks’).append(‘<li>’ + ta.task.name + ‘</ul>’); } Reference 1) http://railscasts.com/episodes/348-the-rails-api-gem?view=asciicast 2) https://github.com/rails-api/rails-api 3) http://davidsulc.com/blog/2011/04/10/implementing-a-public-api-in-rails-3/   Securing a API  ( but not … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , | 1 Comment