Thanks,
This is good concise explanation.
I do have the book you suggests, but haven't had the time to go deep enough in 
it.
Furthermore, I went back to it to check what it says about helper creation, but 
didn't quite understood

Cheers,
Christophe
Le 9 mars 2010 à 15:08, Andy Jeffries a écrit :

> On 9 March 2010 13:30, Christophe Decaux <[email protected]> wrote:
> Thanks,
> That's a good start.
> 
> Any advice where to start looking for how to make a helper method ?
> 
> I'd recommend Agile Web Development with Rails (Pragmatic Programmers book).  
> I looked online but couldn't see a lot that was easy to learn from.
> 
> Basically a helper method is a method that is available in your views and 
> (can be) used for generating markup that would be repetitive otherwise.
> 
> For example you could have something this:
> 
> application_helper.rb:
> module ApplicationHelper
>   def christophe_link_action(image_filename)
>     link_to_remote (image_tag(image_filename, :size=>"16x16"),
>>                                                
>> :url=>"/message/#{message.id}/hide",
>>                                                :method=>"post",
>>                                                
>> :before=>"Effect.Fade(this.parentNode.parentNode, {duration:
>> 0.5});
>>                                                                
>> Effect.BlindUp(this.parentNode.parentNode, {duration: 0.5})")
>    end
> end
> 
> Then in your view just do:
> 
> <%= christophe_link_action("foo.png") %>
> <%= christophe_link_action("bar.png") %>
> 
> Does that make things any clearer?  If not, I'd recommend the book I 
> mentioned earlier (or post back with questions).
> 
> Cheers,
> 
> 
> Andy
> 
> -- 
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to