Posts Tagged ‘Ruby’

Liquid Basics

Posted in Rails, Ruby, Ruby on Rails, liquid, ror on March 3rd, 2009 by admin – 1 Comment

Liquid is a template engine extracted from the e-commerce system Shopify. Now t is a stand alone ruby library. Liquid can be used either in a Ruby application or in a Ruby On Rails application

Why Should We Use liquid ?

  1. Allow users to edit the appearance of your application.
  2. Easy and secure.
  3. Render templates directly from the database.
  4. Style HTML as well as emails.
  5. Extending Liquid is very easy
  6. Simple markups.
  7. If you like Smarty-style template engines

How to get it?

Liquid can be installed either as liquid gem or plugin.

Plugin can be installed simply with by script/install:

RubyGems

Liquid Basics
Liquid have two type of markups

  • Output markup (which may resolve to text)

             {{ matched pairs of curly brackets (ie, braces) }}
example

  • Tag markup (which cannot resolve to text and are used for logic)

             {% matched pairs of curly brackets and percent signs %}
example

Dynamic Scope Methods in Edge Rails

Posted in Rails, Ruby on Rails, ror on December 30th, 2008 by admin – 3 Comments

We perform simple queries using dynamic finder and for commonly used query logic we use named scope.

but we cant chain query conditions when using these dynamic finders.

With the addition of dynamic scopes, we can now have a way to both quickly specify query logic and chain further conditions.


We can now use class methods like scoped_by_user_name(user_name) and scoped_by_user_name_and_password(user_name, password) that will use the scoped method with attributes you supply.

Merb gets merged into Rails 3

Posted in Rails, Ruby on Rails on December 28th, 2008 by admin – Be the first to comment

Ruby on Rails and Merb team decided to

First Ruby Fun Day : A Ruby And Ruby On Rails Event In India

Posted in Rails, Ruby, Ruby on Rails, ror on November 19th, 2008 by admin – Be the first to comment

Geekeerie organising a full day ruby and ruby on rails event scheduled on 22, Nov 2008 at Impetus Technologies, D-40, Sector 59,NOIDA,UP,India Noida, India.

And not just that, RubyFunDay comes with free goooodies like lunch and Ruby p T-Shirt.

So as you have signed up already for the event, please provide us your T-Shirt size here http://spreadsheets.google.com/viewform?key=p2AxAft0ZpLVXLO-mLbpPFw

For event details and participation confirmation: visit http://rubyonrails.in/events/3

How to use SyntaxHighlighter

Posted in Rails, Ruby on Rails, SyntaxHighlighter, ror on July 23rd, 2007 by admin – Be the first to comment

SyntaxHighlighter:

SyntaxHighlighter is a source code syntax highlighting plugin to help a developer/coder to post code snippets online with ease and and without having to worry about applying format. It is a free JavaScript tool for source code Syntex highlighting , It doesn’t care what you have on your server.

The idea behind SyntaxHighlighter is to allow insertion of colored code snippets on a web page without relying on any server side scripts.

WP-dp.SyntaxHighlighter supported languages:

  • C#
  • CSS
  • C++
  • VB & VB.NET
  • Delphi, Pascal
  • Java
  • JavaScript
  • PHP
  • Python
  • Ruby
  • SQL
  • XML, HTML, XSLT and any other XML style code

Click Here to download SyntaxHighlighter

http://syntaxhighlighter.googlecode.com/files/SyntaxHighlighter_1.5.0.zip

How to use SyntaxHighlighter

Place your code on the page and surround it with <pre> tag. Set name attribute to code and class attribute to one of the language aliases you wish to use.

<div class=”dp-highlighter> </div>

<pre name=”code” class=”ruby” style=”display: none;>
… some code here …
</pre>

An alternative to <pre> is to use <textarea> tag.

<textarea name=”code” class=”ruby”>
… some code here …
</textarea>

And You will get an output like