Archive for February 21st, 2008

@content_for_layout

If you create a template file in the app/views/layouts with the same name as a controller, all views used by that controller will use that layout by default.controller/store_controller.rb ::::: consists of method1 & method2

def method1
@first_name = “Rajesh”
end

def method2
@last_name = “Kumar”
end

views/store :::::: consists two html method1.rhtml & method2.rhtml

method1.rhtml
<h2>My first name is :: <%= @first_name %> </h2>

method2.rhtml
<h2>My last name is :: <%= @last_name %> </h2>

views/layouts/store.rhtml ::::: same as controller’s name
<html>
<body>
<h4>This is the main template </h4>
<i> Rails automatically sets the variable @content_for_layout to the page specific content- the stuff generated by the view invoked.</i>
<div>
<%= @content_for_layout %>
</div>
</body>
</html>

http:// ………/store/method1
This is the main template
Rails automatically sets the variable @content_for_layout to the page specific content- the stuff generated by the view invoked.
My first name is :: Rajesh

http:// ………/store/method2
This is the main template
Rails automatically sets the variable @content_for_layout to the page specific content- the stuff generated by the view invoked.
My last name is :: Kumar

Add comment February 21, 2008

Mumbai Meri Jaan

Wo Bhajan gane ki aawaj aa rahi thi,
Uncle jee busy the shabdpat (crossword game) solve karne me,
Bhai Saab was pretending to be asleep when I asked him “Bhaiya thori jagah do na!”
This gentleman was stick to Business Times,
The other lean chap in glass was balancing the laptop over his poor shoulder.
Meanwhile somebody kicked me from back and started singing a song: 10rupye me 12 santre lo – Khatta Mittha.

Finally I took a corner, plugged my iPod, clamped my hands blessed by those hathkadi (hanging iron bars)…thanked GOD, I could reach Vashi Railway Station safely.

This was a scenario for me; I never felt it would be a never forgettable login form for everyday similar to our orbit login@v2.

Yes-dear friends—truly, this is the most vibrant artifact LOCAL TRAIN in Mumbai.
In fact I was quite excited about my coming from Bangalore to this mind-blowing metro, but the crowd realized my
GK that why is it known as THE CITY OF INDIA’S ECONOMY. Well there is a lot about this urbanized domain, but LT(short for Local train…) is one, which pays your attention quickly. Damn!! The way people get on and get down ………

The most amazing fact is, every compartment will be THRICE overloaded, but still those uncles will be complaining about their boss, examinees are inhaling their notes, Radiocity is live with that funk, couples have got a good hold on each other & communicating in 143 binary codes (Oops!! you and I cant break that cipher), Hmm… he could ignore that stinking guy in the same shirt since last Diwali, you got a phone call – No problem except that sometimes poor signals make you a center of attraction in the crowd.

More to say here… AD companies don’t need an advertisement board. Bring your posters and train is the best place for its agile publicity. You want PAN card agent, Shaktibhog aata, jobs@home, hair plus-plus, obesity minus-minus, movie@theater, Maa Shakti ka Pravachan or stuff may take care of your health. Everything is in your dubba. Just keep on your eyes on what are you looking for?

I loved it…. I really liked the way Government is managing this bulky hardware and moreover the people are managing them into this complex clustered architecture. One thing I started not believing & it’s my wristwatch; coz digital watch on the platform looks greater efficient and more useful than watch in my hand.

Probably Mumbai LT is the best example of a human life, which may begin with so much struggle & kind of adjustment we do in between, manage the people/belongings around us & finally get down at your destination with a great contentment.

So what is there to learn from this? Yes it is the TIME FACTOR.

Despite the crowds, shouting, struggles and adjustments, train reaches to a destination at right time. Hardly we find any fluctuation of over a minute or two. So why can’t we be like that?

Why do we always blame others?
Why do we always put others in question escaping ourselves?
Why do we always disrespect a system?

Thanks to those daily passengers admitted their gratitude towards LT by putting posters in few bogies & stating: “Happy DurgaPooja from 8:40 group”. I feel great about them, I feel great about LT who promised to be always on track@right time. Plunge forward! I say to them.

Hence take a lesson from LT and always deliver things@right time in your life despite your problems.
Be punctual & be fast, cause..

Gadi bula rahi hai, siti baja rahi ha
Chalna hi zindgi hi, chalti hi ja rahi ha……………………..

Article by:
PRAYAS.

Add comment February 21, 2008

find(ActiveRecord::Base)

# returns the object for very first row or dierctly put the first row ID like 156789
find_first_as_object = Rating.find(:first)
#p find_first_as_object.ratee_identity_id #1287065605

find_first_as_object_using_idnum = Rating.find(1)  # search for id =1

# returns as an array of object(one element array)
find_first_as_array = Rating.find([569384240])
# p find_first_as_array[0].ratee_identity_id #1287065605

find_first_with_condition = Rating.find(:first, :conditions => [”rating = 4″])

==================================

find_objects_with_selected_attributes = Rating.find(:all,:select => ‘rating as RR’)

my_distinct = Rating.find(:all, :select =>”distinct rating” )

find_first_with_condition_plus_order = Rating.find(:first,
:conditions => [”rating = 4″],
:o rder => “ratingdate DESC”)

===================================

find_all = Rating.find(:all) # returns an array of objects

find_all_by_limit = Rating.find(:all, :conditions => [”rating >= 3 “],:limit => 10)

find_all_by_group = Rating.find(:all,
:conditions => [”rating >= 3 “],
:group => “rating”)

===================================

# find_by_sql returns an ARRAY of objects
find_sql = Rating.find_by_sql(”select rating as goodRating from ratings where rating >=3″)

find_sql_using_var = Rating.find_by_sql(”select * from ratings where id = ?”, ratee_identity_id)

===================================

find_first_by_rating = Rating.find_by_rating(”3″)
# Rating.find(:first, conditions => “rating = 3”)

find_all_by_rating = Rating.find_all_by_rating(”3″)
#  Rating.find(:all, conditions => “rating = 3”)

Add comment February 21, 2008

‘Idiots’ from IIT

If rumours are to be believed Aamir Khan has signed on the dotted line to act in Rajkumar Hirani’s next venture tentatively titled ‘Idiots’.

Aamir has confirmed the development in his blog (www.aamirkhan.com) and if things work out well between one of India’s most versatile actors and the man behind the ‘Munnabhai’ movies, it could well become a cinematic super-success.

The latest Raju Hirani film would be produced by his mentor Vidhu Vinod Chopra and there was some gossip that Chopra and Shah Rukh had some disagreements over which they decided to part ways on ‘Idiots’. Needless to say, Shah Rukh’s loss proved to be Aamir’s gain.

Hirani has also approached Saif Ali Khan, Shah Rukh and John Abraham for roles in the film, which is based on Chetan Bhagat’s Five Point Someone’ and deals with the story of three IIT students.

<%

The book starts with a disclaimer, “This is not a book to teach you how to get into IIT or even how to live in college. In fact, it describes how screwed up things can get if you don’t think straight.”

Three hostelmates – Alok, Hari and Ryan get off to a bad start in IIT – they screw up the first class quiz. And while they try to make amends, things only get worse. It takes them a while to realize: If you try and screw with the IIT system, it comes back to double screw you. Before they know it, they are at the lowest echelons of IIT society. They have a five-point-something GPA out of ten, ranking near the end of their class. This GPA is a tattoo that will remain with them, and come in the way of anything else that matters – their friendship, their future, their love life. While the world expects IITians to conquer the world, these guys are struggling to survive.

Will they make it? Do underperformers have a right to live? Can they show that they are not just a five-point-somebody but a five-point-someone?

%>

And speaking of Saif, there are reports that Kareena could be part of the ‘Idiots’ team too. This follows rumours that Hirani, who approached Kajol for the role, was upset at her comments that she would first read the script before accepting the offer.

Add comment February 21, 2008


@@name=PRAYAS

gap_resize.jpg

Time.now()

February 2008
M T W T F S S
    Mar »
 123
45678910
11121314151617
18192021222324
2526272829  

order[:category]

posts[:recent]

episodes[:recycled]

links[:favourite]

vote_for_web2.0

Step down at my blog with your ideas,comments,suggestions on Ruby,RoR,Ajax or Web2.0 Technology. You may reach me at rajesh4it@gmail.com.

@visitors.count(Feb’08)

find_all(:categories)

Around me bollywood coding news@RoR Rails RoR Ruby Tools&Tips Web2.0 talks

Vote for RoR

Blog Stats