768x90 Getting Online Shouldn't be Tough- $7.49 .com Domains at Go Daddy

How to use find_by_sql without Model

many cases, we use model to use find_by_sql like ModelName.find_by_sql, but now how we can find_by_sql without mode?ActiveRecord::Base.connection.execute 'select * from users'To return array of hashes, you can use it :ActiveRecord::Base.connection.select_a...

Translation for your Ruby on Rails App

I am writing this article with accompanied by a cup of coffee while waiting MU Vs Chealsea for Champion Final. Back to the topic. You should know many familiar online translation like google and altavista. Now i will like to introduce you about gibberish in rails. Let start it :Install the plugin to your app rails.ruby script/plugin install http://svn.myutil.com/projects/plugins/gibberish_rails/orruby...

Simple & Awesome Rails Form

How to create Simple, fast and awesome rails form in your rhtml or html.erb ? the answer for now is Super_In_Place_Controls & I tested in Rails 2.0. Let start to use it :Install the plugin to your ruby appruby script/plugin install http://os.flvorful.com/svn/plugins/super_in_place_controlsIn your layout or rhtml / html.erb put it :<%= stylesheet_link_tag 'in_place_styles' %>Done !!, let...

Create Realtime World News in Your Site

What could you do if you had access to the world’s news, and had a standardized and rational way to get quick responses to rich queries about what’s happening in the world? What could you build if you could incorporate dynamic, global, continually refreshed, high quality content into your applications, widgets, and websites? You should have many answers. But I have only 1 act, I will smileproudly. :D. Let's start to implement it by using Ruby on Rails:Get API Key HEREDownload this code and paste...

Snapshot Web Page trough Ruby

Some times, newbie question is valuable for me. Thanks for some one who asked about Snapshot a webpage in ruby by providing web url. Let see it :Sign Up a free account HEREGet Your API Key, after logged in.Create a New File in your Model with name snapweb.rb, than paste code below inside :require 'net/http'require 'rubygems'require 'xmlsimple'class Snapweb@@api_baseurl = 'http://webthumb.bluga.net/api.php'@@api_key = 'fc52f8bdb9e5b86f8150a145d5c8fd97'attr_accessor :collection_time, :job_id, :okdef...

Live Validation Field with AJAX

LiveValidation is a small open source javascript library for making client-side validation quick, easy, and powerful. It comprises of two main parts. Firstly, it provides developers with a rich set of core validation methods, which can also be used outside the context of forms. Secondly, it provides your visitors with real-time validation information as they fill out forms, helping them to get it right first time, making the forms easier, quicker and less daunting to complete.The naming conventions...

Random Characters in Ruby on Rails

AlphaNumeric Random Characters>> chars = ("a".."z").to_a + ("1".."15").to_a>> newpass = Array.new(8, '').collect{chars[rand(chars.size)]}.join>> "8xa2b13f"Another AlphaNumeric Random Characters>> (1..8).map{ (0..?z).map(&:chr).grep(/[a-z\d]/i)[rand(62)]}.join>> "JH789gfd"ASCII Random Characters>> (0..5).inject('') { |r, i| r << rand(93) + 33 }>> "S#;o...

Date and Time Functions in Ruby on Rails

This is implementation of Date and Time in Database (MySQL) into Ruby on RailExample:BillPay.find(:all, :order => 'weekday(paid_at)' )BillPay.find(:all, :select => 'day_of_year(paid_at) as "Days" ' ) Name Description ADDDATE()(v4.1.1) Add dates ADDTIME()(v4.1.1) Add time CONVERT_TZ()(v4.1.3) Convert from one timezone to another CURDATE() Return the current date CURRENT_DATE(), CURRENT_DATE Synonyms for CURDATE() CURRENT_TIME(), CURRENT_TIME Synonyms for CURTIME() CURRENT_TIMESTAMP(),...

link_to_file - Call File from .rhtml or .html.erb

Open app/helpers/application_helper.rbPaste it : def link_to_file(name, file, *args) if file[0] != ?/ file = "#{@request.relative_url_root}/#{file}" end link_to name, file, *args endIn your view, put it: <%= link_to_file "teapoci file here", "teapoci.php" %>...
 
powered by Blogger