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 Error – SQL_BIG_SELECTS

While executing JOIN SQL query in live server, i got the following error. [code] The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay: [/code] To resolve this error, I have used the following SQL query before executing the JOIN SQL query. …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/08/mysql-error-sql_big_selects/

Mysql GROUP_CONCAT

MySQL has useful extention to the GROUP BY operation – function GROUP_CONCAT: GROUP_CONCAT(expr) – This function returns a string result with the concatenated non-NULL values from a group. Returns NULL when there are no non-NULL values. Where it can be useful? For example to get array without looping inside the code, In single SQL query …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/05/mysql-group_concat/

Connect MS SQL Server with Rails

To connect MS SQL Server with Ruby on Rails follow the below steps: SQL Server (2005 or higher recommended) Install the adapters and driver [code] gem install tiny_tds gem install activerecord-sqlserver-adapter [/code] Ensure the activerecord adapter and db driver gems are defined in your Gemfile [code] gem ‘tiny_tds’ gem ‘activerecord-sqlserver-adapter’ [/code]

Permanent link to this article: https://blog.openshell.in/2013/04/connect-ms-sql-server-with-rails/

Unable to create rails application with sqlserver

Could not find “config/databases/sqlserver.yml” in any of your source paths. Your current source paths are: $HOME/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/generators/rails/app/templates Error: Template sqlserver.yml file missing. Solution: Need to update sqlserver.yml file in the specific location to fix this issue. Step1: Download sqlserver.yml configuration file. Step2: Extract the downloaded zip file. Step3: Copy extracted sqlserver.yml configuration file into the location which …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/04/unable-to-create-rails-application-with-sqlserver/

mysql2 gem for windows error

By  installing  Development Kit and MySql Connector: To install Development Kit: 1. Left double-click the self-extracting executable (SFX)  to install the DevKit artifacts into. For example, C:DevKit. 2. cd <DEVKIT_INSTALL_DIR> 3. ruby dk.rb init to generate the config.yml. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/mysql2-gem-for-windows-error/

Disable foreign key checks in MySQL

Disabling foreign key checks in MySQL is usefull when you are dealing with tables that use foreign keys (InnoDB engine). You can not delete (drop) multiple tables, a parent table or a child table until you disable foreign key checks four your current database. The sql command to disable foreign key checks is: [sql]SET FOREIGN_KEY_CHECKS …

Continue reading

Permanent link to this article: https://blog.openshell.in/2012/09/disable-foreign-key-checks-in-mysql/

Segmentation fault with rake db:create in ruby on rails

Whenever we invoke rake db:migrate, getting segmentation fault error. Segmentation fault ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32] Code Aborted probably a bug in our database connectivity DLL file Place this linmysql.dll file within your ruby/bin folder. If the file exists already, replace that file by this file. Download libmySQL.dll

Permanent link to this article: https://blog.openshell.in/2012/07/segmentation-fault-with-rake-dbcreate-in-ruby-on-rails/

PHP MYSQL ORDER BY Multiple Columns

If you want to Order 2 or more columns in SQL Query. When ordering by more than one column, the second column is only used if the values are identical with the onces in the first column. Example [sql] ‘Order by Column ORDER BY COLUMN1, COLUMN2 [/sql] Order 2 or more columns with different orders …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/09/php-mysql-order-by-multiple-columns/

uninitialized constant Rake::DSL Ruby Windows Solution

rake aborted! uninitialized constant Rake::DSL C:/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing’ C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.1/lib/rake/tasklib.rb:8:in `’ Now, the first step I took towards solving this problem is to issue “bundle update rake” command to update my rake. This will update rake to the latest version. An example log for this update is provided below; bundle update rake Fetching source index for http://rubygems.org/ …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/07/uninitialized-constant-rakedsl-ruby-windows-solution/

Window.open Not Working In IE

If you use window.open to open custom windows with JavaScript, you might encounter problems in Internet Explorer. Even though you can open new windows in other browsers, it doesn’t work in IE. The reason to this is it depends on how you name your JavaScript windows. IE doesn’t allow space here. window.open takes three parameters …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/07/window-open-not-working-in-ie/