HighDots Forums  

link_to_remote with image_tag using Paperclip

Ruby On Rails Talk Ruby On Rails programming language mailing list


Discuss link_to_remote with image_tag using Paperclip in the Ruby On Rails Talk forum.



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

Default link_to_remote with image_tag using Paperclip - 11-08-2009 , 12:33 AM






I am creating a layout of images with links.

In Photo model:

has_attached_file :mainimg, :styles => {riginal =>
"465x365", :thumb => "80x70"}

In my Front controller:

def index
@photos = Photo.find(:all)
@photos = Photo.paginate er_page => 28, age => params[age]
end

In index.dryml:

<% outer = 'a' %>
<% inner = 1 %>
<% @photos.in_groups_of(7).each do |photorow| %>
<div id="<%= outer %>">
<% photorow.each do |photo| %>
<div id="<%= inner %>">
<% link_to_remote (image_tag(photo.mainimg.url(:thumb)),
:url => {:action => 'projects/show', :id => '#
{photo.project_id}'}) if photo.mainimg? %>
</div>
<% inner += 1 %>
<% end %>
</div>
<% outer = outer.succ %>
<% end %>
<%= will_paginate @photos, age_links => false %>

Evidently image_tag(photo.mainimg.url(:thumb) is not right, but being
a novice not sure where I am
going wrong.

Thanks,

Jet


--~--~---------~--~----~------------~-------~--~----~
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   
Sijo k g
 
Posts: n/a

Default Re: link_to_remote with image_tag using Paperclip - 11-09-2009 , 12:23 AM






Hi Jet Thompson


I have not used Paperclip. But an example usage of
link_to_remote+image_tag is

link_to_remote (image_tag("/images/cancel.png", {:alt => 'Cancel',
:class=>"classhere",:title=>"Cancel"}),{:url => { :action =>
'projects/show', :id => "#{photo.project_id}"}})



Sijo
--
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.