” Arthur Neil “.squeeze(” “).strip To find empty characters/space in a filed; use if params[:description].squeeze(” “).strip.length == 0 [handle it here] end
Posts Tagged ‘lessons’
Removing extra whitespaces from string or params [Ruby on Rails]
Posted in Ruby on Rails, tagged lessons, ruby, Ruby on Rails on July 10, 2009 | Leave a Comment »
Nice Teaching
Posted in Fun-and-morals, Lessons I have learnt, tagged funs, jokes, lessons, morals on July 1, 2009 | Leave a Comment »
First-year students at Veterinary school were attending their first Anatomy class, with a real dead pig. They all gathered around the surgery table with the body covered with a White sheet. The professor started the class by telling them, ‘In Veterinary Medicine it is necessary to have two important qualities as a Doctor: The first [...]
‘load_missing_constant’: uninitialized constant Inflector (NameError) -[Active Merchant and RoR]
Posted in installations, Ruby on Rails, Weird Errors, tagged bug fixes, installations, lessons, Ruby on Rails on June 30, 2009 | Leave a Comment »
If you have recently updated to Rails 2.2 or +, you may encounter this error: /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant’: uninitialized constant Inflector (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing’ from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing’ from /usr/local/rails/mogulus/vendor/plugins/active_merchant/lib/active_merchant/billing/integrations.rb:13 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’ Go to the error file; /usr/local/rails/mogulus/vendor/plugins/active_merchant/lib/active_merchant/billing/integrations.rb and replace; Inflector.inflections do |inflect| . . . end with; ActiveSupport::Inflector.inflections do |inflect| . . . end
No such file to load mysql – Ruby on Rails [even after gem install mysql]
Posted in installations, Ruby on Rails, Weird Errors, tagged bug fixes, installations, lessons, Ruby on Rails on June 25, 2009 | Leave a Comment »
You may face some issues while configuring rails; no such file to load — mysql /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’ /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’ /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require’ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/mysql_adapter.rb:65:in `mysql_connection’ and so on step 1: If you havn’t done “gem install mysql”; do it first. step 2: If it doesn’t work even after “gem install mysql”; search for “mysql.so” in your system. [...]
Single/custom table name for a model in Ruby on Rails
Posted in Ruby on Rails, tagged lessons, Ruby on Rails on June 20, 2009 | Leave a Comment »
Use; set_table_name :name_of_the_table in your model (E.g) class myTable < ActiveRecord::Base set_table_name :media end
The Eyes
Posted in Fun-and-morals, Lessons I have learnt, tagged funs, lessons, morals on May 20, 2009 | Leave a Comment »
Eyes have one language everywhere…..
Generating sitemap in Ruby on Rails
Posted in Ruby on Rails, tagged lessons, Ruby on Rails on April 27, 2009 | Leave a Comment »
Create a controller with the name ‘sitemap’ (or) with the name you desire….. (E.g) ruby script/generate controller sitemap (or) You can manually create one [app/controllers/sitemap_controller.rb] When you view the ‘controller file’ which you created just now, it would look like; class SitemapController < ApplicationController end Once it’s done, we need to add the functionality to [...]
Calling External Javascript after Ajax Call [Mootoools]
Posted in Javascript, tagged javascripts, lessons, tips on April 24, 2009 | 1 Comment »
If you are trying to run the script in an updated div, that may work with the internal scripts – something like; <script type=”text/javascript”> alert(‘hello’); </script> But when you try to access some external javascrips, (e.g); <script type=”text/javascript”> <script type=”text/javascript” src=”/javascripts/my_script.js”></script> </script> that will not work. The work-around is; [if you are using mootools.js for [...]
Experience
Posted in Lessons I have learnt, tagged lessons, morals on April 20, 2009 | Leave a Comment »
Experience is a kind of teacher; who gives the test first before presenting the lesson.
Who is at Risk?
Posted in Fun-and-morals, tagged funs, lessons, morals on April 13, 2009 | Leave a Comment »
A mouse looked through a crack in the wall to see the farmer and his wife opening a package; what food might it contain? He was surprised to discover that it was a mouse trap! Retreating to the farmyard, the mouse proclaimed the warning, “There is a mouse trap in the house, there is a [...]