Category: Ruby On Rails

Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.

MySQL Subquery Optimization

Never use a subquery inside a WHERE field IN(…)  the SQL query.  It will slow down the process. Slow: SELECT * FORM table1 WHERE field1 IN (SELECT field2 FROM table2 GROUP BY field1) Instead of using a subquery inside an IN(…),  use INNER JOIN query. It will speed up the process, but in IN(…) query …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/mysql-subquery-optimization/

Enable .htaccess in Apache2

At first You should define,  mod_rewrite is a part of Apache server that can rewrite requested urls on the fly. To enable in Ubuntu, you just need to write this command in terminal sudo a2enmod rewrite Then edit /etc/apache2/sites-available/default Find the following Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all and change …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/enable-htaccess-in-apache2/

Configure Ruby on Rails with no database

Although Rails is intended for creating database-backed web applications, this example is simple enough that it doesn’t require one. In this case, you need to edit the enviroment.rb configuration file to indicate that your application does not use a database. It is possible to disable loading ActiveRecord by making a simple modification to environment.rb: 1. …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/configure-ruby-on-rails-with-no-database/

How to avoid Conflict in jQuery

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery’s case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/how-to-avoid-conflict-in-jquery/

Fixing libmysql.dll issue in Rails

While working on rails with mysql as database you may got error like this “This application has failed to start because libmysql.dll was not found. Re-installing the application may fix this problem” while executing the code ‘rake db:create’. If that so, then fallow the fallowing steps: 1. type the command in the console gem install …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/fixing-libmysql-dll-issue-in-rails/

Tips for using jQuery

Find if something is hidden: We use .hide(), .show() methods in jquery to change the visibility of an element. Use following code to check the whether an element is visible or not. if($(element).is(“:visible”) == “true”) { //The element is Visible } Center an element on the Screen: To make align the element to center. jQuery.fn.center …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/tips-for-using-jquery/

Quoting HTML attribute values

The values of attributes can contain text, hexadecimal color codes or numbers. In case of JavaScript event handlers, the values consist of small JavaScript code. A sincere advice for good and clean HTML coding is to always put quotes around attribute values. It is a good habit, will save you many headaches and avoid errors …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/quoting-html-attribute-values/

HTML mailto attribute

The HTML mailto is a quick way to add the facility of receiving feedback from visitor on the web site. when the visitor clicked the HTML mailto, It lanuches their email program with new email window. Note: HTML mailto assumes that the visitor has configured an email client (Outlook Express, Netscape Messenger, Thunderbird or any …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/html-mailto-attribute/

Tips to inspect the code in Rails

Inspect It inspects the value. It formats the array with square brace, hash with curly braces with arrows between the key value pairs inspecting parameter. Type It identifying the type of the instance variable. Debug It give nice, easy to read inspection of the value and displayed in a formatted way. These are all some …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/tips-to-inspect-the-code-in-rails/

Ruby Symbols Description

Matter related to the old and new Ruby programmer, and Ruby’s symbols are confusing sometimes or always. Smoothly before this, can not get used is pretty. People learn about the Ruby language is often Rubionreiruzu learn from the project. The Rubionreiruzu symbol is everywhere. There really is everywhere. So, pay attention to the concept of …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/ruby-symbols-description/