Posts

Rails zip_code validations with prefix zero issue

rails if we make zip_code as integer value in database it will not gives the zip_code validations when we give zip_code as 01234 it takes as 1234 like all prefix zeros solution:- we have to to make zip_code as string then it will validates zip_code properly to all zip_codes like 01234

Rails action catching with parameters values

http://cobaltedge.com/rails-action-caching-with-query-parameters

Ruby on Rails all installations in ubuntu

Ruby on Rails all installations in ubuntu #################################################### #                                                                                       # #      https://help.ubuntu.com/community/RubyOnRails           # #                                                                                       # ####################################################

PDFTron SDK for ruby Sample code

The sample code for PDFTron is giver separate for all languages http://www.pdftron.com/pdfnet/samplecode.html Click on ruby link in each topic for ruby code.

issue while installing rails_admin gem in ruby on rails

if we get the error while installing rails_admin for the error lib/rails_admin/config/fields/types.rb:11:in `load': Unsupported field datatype: binary (RuntimeError) we have to follow below code in config/initializers/rails_admin.rb since I don't display the binary field I put this monkey patch in my initializer: module RailsAdmin module Config module Fields module Types def self . load ( type ) return @@registry [ :text ] if ( type . to_sym == :binary ) @@registry [ type . to_sym ] or raise "Unsupported field datatype: #{ type } " end end end end end

Admin Interfaces for Rails Apps: RailsAdmin vs ActiveAdmin

The complete article is on http://batsov.com/articles/2011/11/20/admin-interfaces-for-rails-apps-railsadmin-vs-activeadmin/

What's the difference between "include" and "require" in Ruby?

The include and require methods do very different things. The require method does what include does in most other programming languages: run another file. It also tracks what you've required in the past and won't require the same file twice. To run another file without this added functionality, you can use the load method. The include method takes all the methods from another module and includes them into the current module. This is a language-level thing as opposed to a file-level thing as with require. The include method is the primary way to "extend" classes with other modules (usually referred to as mix-ins). For example, if your class defines the method "each", you can include the mixin module Enumerable and it can act as a collection. This can be confusing as the include verb is used very differently in other languages.