Hi there!
Can anyone point me in the direction of some resources for building
your own view helpers?
I want to acheive something simple:
In the view,
<%= button do %>
Delete
<% end %>
will give
in the source?
Can anybody help out?
thanks
Hi there!
Can anyone point me in the direction of some resources for building
your own view helpers?
I want to acheive something simple:
In the view,
<%= button do %>
Delete
<% end %>
will give
in the source?
Can anybody help out?
thanks
On Sun, Nov 16, 2008 at 11:58 PM, Dr_Gavin [email protected] wrote:
Delete
Can anybody help out?
thanks
mmmh, I guess
def button
content_tag :div, :class => “button”
end
will to the trick. but it is just because it is simple… If you have
something complex, you hav to play with capture()
Another simple way, is to play with partials. you can use
def button
render :layout => ‘/shared/button’
end
hope it will help
–
Gabriel L. [email protected]
Hey Gabriel - thanks for the advice.
Sorry for the late reply.
I’ve managed to get this working
def delete_button_for(value, path, confirm=nil, id=nil)
content_tag :div,(link_to_remote value, {:url => path,
:method => :delete, :confirm => confirm}), :class =>
‘button’, :id => id
end
Thanks again
Gavin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs