Category Archives: rails

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

AngularJS with Rails

1) Check the following URL for installation http://blog.ricodigo.com/blog/2012/10/14/announcing-the-release-of-angularjs-scaffold/ 2) for basics and for advance coding refer the following URL http://angularjs.org/ 3) for Installing/coding jasmine 1) https://github.com/pivotal/jasmine/wiki/A-Ruby-project-%28with-or-without-Rails%29 2) http://railscasts.com/episodes/261-testing-javascript-with-jasmine   http://www.klairvoyant.in

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

spree tools and tutorials

1) deface http://guides.spreecommerce.com/view_customization.html http://deface.heroku.com/ https://github.com/spree/deface http://blog.endpoint.com/2010/01/rails-ecommerce-spree-hooks-tutorial.html 2)Theams 1) https://github.com/spree/spree_fancy https://github.com/search?langOverride=&p=5&q=spree+theme&repo=&start_value=1&type=Repositories 3) Gem http://guides.rubygems.org/specification-reference/#licenses=http://docs.rubygems.org/read/chapter/20 http://www.klairvoyant.in

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

what is rails templates ?

generators can be used inside an application, they can also be used to generate applications too, This kind of generator is referred as a “template”. example gem(“rspec-rails”, :group => “test”) gem(“cucumber-rails”, :group => “test”) if yes?(“Would you like to install … Continue reading

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

How to create a Gem file

1) bundle gem gemwork1 (My IDE has option for “Gem Application” and given the name “gemwork1” as the application name) 2) in ‘lib/gemwork1.rb’ add the functionality code example add the following code to already existing module “Gemwork1”. here we adding … Continue reading

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

Raphaël ( JavaScript library ) in rails

1) Download raphael.js ( downloaded file not worked with me. so fetched it from source code of sample works) 2) added it to the folder app/assets/javascripts 3) create a javascript file for our Raphaël code example $(document).ready(function(){ var paper = … Continue reading

Posted in javascript, rails, ruby on rails, web development | Tagged , , , | 6 Comments