radhames brito wrote:
> show the code where you are trying to access, ill see whats wrong with 
> it

Thanks @radhames.

The main issue is how to make a call to the height() and width() methods 
in the model in this line in "show.html.erb":

<canvas id="draw" height = "?????" width= "?????">
</canvas>

This is my model"dicom.rb":

class Dicom < ActiveRecord::Base
  has_attached_file :photo, :styles => {
  :original => ["100%", :jpg],
  }

  def height()
  uploaded_file = photo.queued_for_write[:original]
  dimensions = Paperclip::Geometry.from_file(uploaded_file)
  return dimensions.height
end

  def width()
  uploaded_file = photo.queued_for_write[:original]
  dimensions = Paperclip::Geometry.from_file(uploaded_file)
  return dimensions.width
  end
end

And, this is my "show.html.erb":

<%= javascript_include_tag "coordinate" %>
<canvas id="draw" height = "" width= "">
</canvas>
<p id="notice"><%= notice %></p>
<p>
<b> Name </b>
<%= @dicom.name %>
</p>
<p>
<b> Image </b>
</p>
<div id="image_element" style="display: none;">
<p>
<%= image_tag @dicom.photo.url , :id => 'dicom_image' %>
</p>
</div>
<%= update_page_tag do |page|
page << "drawImg();"
end
%>
<%= update_page_tag do |page|
page << "drawLine();"
end
%>
<%= link_to 'Edit', edit_dicom_path(@dicom) %>
<%= link_to 'Back', dicoms_path %>

Thanks a lot.
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to