Blog Archives

Feedzirra installation, Problem faced & Solution/ How I installed Feedzirra

What I did? When In gem file I wrote this gem “feedzirra”, “~> 0.3.0” and run bundle install Bellow Error came to me. Saying that there is missing of some extension What Happened to me? Gem::Installer::ExtensionBuildError: ERROR: Failed to build

Tagged with: , ,
Posted in Uncategorized

Tests inside Sublime Text

Originally posted on Precious Info:
Go to your Sublime Text 2 Packages directory: OS X: ~/Library/Application\ Support/Sublime\ Text\ 2/Packages Windows: %APPDATA%/Sublime Text 2/Packages/ Linux: ~/.config/sublime-text-2/Packages/ and clone the repository using the command below: git clone https://github.com/maltize/sublime-text-2-ruby-tests.git RubyTest Ref: https://github.com/maltize/sublime-text-2-ruby-tests After…

Posted in Uncategorized

Nested Routes Rails precautions

Resources should never be nested more than 1 level deep. These multi-level nested routes is violation of above mentioned rule. resources :hotels do resources :food_menus do resources :categories do resources :dishes end end end My Questions about Rails Guide Recommendation:

Tagged with: ,
Posted in Uncategorized

Ruby Bang Methods & precautions

Ruby Bang Methods: Methods which have ! sign at the end are called bang methods. Standard Ruby bang methods often return nil if no change was needed. str = ‘FOOBAR’ p str.upcase! #bang mehtod -> return nil p str.upcase #

Tagged with: ,
Posted in Uncategorized

Require File Before & After Rails Load

In config/application.rb #—-File to Load Before Rails Load—–# require File.expand_path(‘../app/models/extenstions/active_record_base_extenstion’, File.dirname(__FILE__)) #————————-# module ProjectName class Application < Rails::Application config.autoload_paths << File.join(config.root, "lib") config.i18n.default_locale = :en #——Code in application.rb—– config.to_prepare do Devise::SessionsController.skip_before_filter :verify_is_admin, :authenticate_admin! Devise::PasswordsController.skip_before_filter :subdomain end end #—-File to Load

Tagged with:
Posted in Uncategorized

Difference b/w Core & Standard Library Ruby

Ruby has two major bits of code that it provides for your use: 1. the core library 2. the standard library The core library can be found here, and contains classes that you know and love, like String, Hash, and

Tagged with:
Posted in Uncategorized

Override/Extend Rails Core classes OR Strip attributes before Save

# active_record_base_extenstion.rb class ActiveRecord::Base before_save :clean_data def clean_data # trim whitespace from beginning and end of string attributes attribute_names.each do |name| if send(name).respond_to?(:strip) send(“#{name}=”, send(name).strip) end end end end

Tagged with: ,
Posted in Uncategorized

Rails 4 Avoid N+1 queries example

Rails 4 Avoid N+1 queries example: class Customer { includes(:items) } end class Order < ActiveRecor… has_many :items end class Items < ActiveRecor… belongs_to :order belongs_to :product end Detail reading

Tagged with:
Posted in Uncategorized

Curl command for hitting post request

Originally posted on Precious Info:
curl -F param1=val1 -F param2=val2 -F param3=val3  http://host:port/abc.json

Posted in Uncategorized

heroku error ActionView::Template::Error (# isn\’t precompiled) fixing

In config/environments/production.rb – config.assets.compile = false + config.assets.compile = true

Tagged with:
Posted in Uncategorized
StackOverFlow
Categories
Archives