HighDots Forums  

partials in rails

Ruby On Rails Talk Ruby On Rails programming language mailing list


Discuss partials in rails in the Ruby On Rails Talk forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Aashish Kiran
 
Posts: n/a

Default partials in rails - 11-07-2009 , 07:03 AM






I am new to rails. can anyone explain in detail about partials in rails.
my rails version is 2.3.4.
How to use them?
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #2  
Old   
Leonardo Mateo
 
Posts: n/a

Default Re: partials in rails - 11-07-2009 , 08:22 AM






On Sat, Nov 7, 2009 at 9:03 AM, Aashish Kiran
<rails-mailing-list (AT) andreas-s (DOT) net> wrote:
Quote:
I am new to rails. can anyone explain in detail about partials in rails.
my rails version is 2.3.4.
How to use them?
Have you search something about this? I'm pretty sure this has been
explained zillions of times before, for example, here:
http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials


--
Leonardo Mateo.
There's no place like ~

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #3  
Old   
Todd A. Jacobs
 
Posts: n/a

Default Re: partials in rails - 11-07-2009 , 04:26 PM



On Sat, Nov 07, 2009 at 01:03:37PM +0100, Aashish Kiran wrote:


Quote:
I am new to rails. can anyone explain in detail about partials in
rails. my rails version is 2.3.4. How to use them?
Partials are basically "includes." The tricky part is generally getting
variables from the main view to propagate to the partial. This requires
using ":locals=>{}" properly, which doesn't always seem to work the way
I expect.

--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #4  
Old   
Marnen Laibow-Koser
 
Posts: n/a

Default Re: partials in rails - 11-07-2009 , 04:38 PM



Todd A. Jacobs wrote:
Quote:
On Sat, Nov 07, 2009 at 01:03:37PM +0100, Aashish Kiran wrote:


I am new to rails. can anyone explain in detail about partials in
rails. my rails version is 2.3.4. How to use them?

Partials are basically "includes." The tricky part is generally getting
variables from the main view to propagate to the partial.
Not tricky at all.

Quote:
This requires
using ":locals=>{}" properly, which doesn't always seem to work the way
I expect.
It has always worked for me. Can you provide an actual example that
doesn't work?

Quote:
--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen (AT) marnen (DOT) org
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #5  
Old   
Prasad Kulkarni
 
Posts: n/a

Default Re: partials in rails - 11-08-2009 , 03:51 AM



Aashish Kiran wrote:
Quote:
I am new to rails. can anyone explain in detail about partials in rails.
my rails version is 2.3.4.
How to use them?
You can think of partials as making function calls from your erb files
which generates templated html for you. The values for template
variables you can pass through local and object variables. If you want
same set of templated html to be generated from N places in your site,
you can create a partial and call this from all of these N places. Any
time you want to change the code you change in one place rather than N
places. It helps you to follow DRY principle.

Thanks
-- Prasad
http://roorky.com
Digital Interactive Publication



--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.