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]
Tag: Ruby
Permanent link to this article: https://blog.openshell.in/2013/04/connect-ms-sql-server-with-rails/
Apr 10
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 …
Permanent link to this article: https://blog.openshell.in/2013/04/unable-to-create-rails-application-with-sqlserver/
Sep 22
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 …
Permanent link to this article: https://blog.openshell.in/2012/09/disable-foreign-key-checks-in-mysql/
Mar 17
Try Catch Finally block in Ruby
This the ruby code which is equivalent of a try/catch/finally block in other languages. #Try catch block Syntax begin somecode() rescue puts “Error #{$!}” ensure this_code_will_execute_always() end # Sample Code f = File.open(“testfile.txt”) begin # .. process rescue # .. handle error else puts “– no errors!” ensure f.close unless f.nil? end
Permanent link to this article: https://blog.openshell.in/2011/03/try-catch-finally-block-in-ruby/
Mar 17
REST methods form request in Ruby On Rails Client
In order to access RESTful web services from Ruby Client script using form request. The method net/http tries to connect over HTTP even of the uri is HTTPS. For HTTPS, You need to explicitly tell net/http that a secure connection should be used. REST client code as shown below: # Basic REST. # Most REST …
Permanent link to this article: https://blog.openshell.in/2011/03/rest-methods-form-request-in-ruby-on-rails-client/
Dec 01
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 …
Permanent link to this article: https://blog.openshell.in/2010/12/html-mailto-attribute/
Nov 30
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 …
Permanent link to this article: https://blog.openshell.in/2010/11/tips-to-inspect-the-code-in-rails/
Nov 28
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 …
Permanent link to this article: https://blog.openshell.in/2010/11/ruby-symbols-description/
Nov 28
Debugging Rails
You can always debug your application and get it back on the rails if ever it something goes wrong. You have to check the application log files. See to it that “tail –f” commands are running on the server.log and development.log. Rails will then show debugging and runtime information to these files and debugging information …
Permanent link to this article: https://blog.openshell.in/2010/11/debugging-rails/
Nov 28
Finders are great but be careful
Finders are very pleasant to use, enable you to write readable code and they don’t require in-depth SQL knowledge. But the nice high level abstraction come with a computational cost. Follow these rules of thumb: Retrieve only the information that you need. A lot of execution time can be wasted by running selects for data …
Permanent link to this article: https://blog.openshell.in/2010/11/finders-are-great-but-be-careful/
- 1
- 2