I have asked this question on this forum: http://www.ruby-forum.com/topic/216998#new I think that main key here is how can I access the method in a model within a view. Is there a way to do that? Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-16 15:37 UTC
Re: How to access a model method from within a view?
Abder-Rahman Ali wrote:> I have asked this question on this forum: > http://www.ruby-forum.com/topic/216998#new > > I think that main key here is how can I access the method in a model > within a view. Is there a way to do that?If you have a model object, you can always call methods on it. But be careful! The principles of MVC architecture state that there shouldn''t be very much logic (if any!) in your view code. You probably want to move the method call to a helper or the controller.> > Thanks.Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-16 18:00 UTC
Re: How to access a model method from within a view?
Thanks Marnen. Should I write the code the gets the height and width in a helper? Do you have an idea of how to do that? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 11:23 UTC
Re: How to access a model method from within a view?
Any ideas on this yet? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 13:20 UTC
Re: Re: How to access a model method from within a view?
models are accessible from all levels of the application, so you can access them the same way you access them from controllers -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 13:23 UTC
Re: Re: How to access a model method from within a view?
Thanks radhames. Can you kindly show me a way on how to code this? As I have been stuck on that for a while. Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 14:05 UTC
Re: Re: Re: How to access a model method from within a view?
show the code where you are trying to access, ill see whats wrong with it On Sun, Sep 19, 2010 at 9:23 AM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Thanks radhames. > > Can you kindly show me a way on how to code this? As I have been stuck > on that for a while. > > Thanks. > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 14:11 UTC
Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> show the code where you are trying to access, ill see whats wrong with > itThanks @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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 14:14 UTC
Re: Re: Re: How to access a model method from within a view?
@radhames. If you want me to send you the whole application, can you sen me your email? I don''t know if you can send me a private message through www.ruby-forum.com? Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Sep-19 14:18 UTC
Re: How to access a model method from within a view?
On Sep 19, 3:11 pm, Abder-Rahman Ali <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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>What''s wrong with <%= some_object.width %> ? Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 14:29 UTC
Re: How to access a model method from within a view?
Frederick Cheung wrote:> On Sep 19, 3:11�pm, Abder-Rahman Ali <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> </canvas> > What''s wrong with <%= some_object.width %> ? > > FredI tried: <canvas id="draw" height = "@dicom.height" width= "@dicom.width"> </canvas> But, I don''t the expected dimensions. As when I calculated the dimensions using this Javascript function: I found that the image width and height is 512x512, and the displayed image is not correct, as when I manually enter the height and width values in the "Canvas", I get a larger image that the one I''m getting. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 19 September 2010 15:29, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote: >> On Sep 19, 3:11�pm, Abder-Rahman Ali <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> </canvas> >> What''s wrong with <%= some_object.width %> ? >> >> Fred > > I tried: > > <canvas id="draw" height = "@dicom.height" width= "@dicom.width">You have to put the bits of ruby code that you want expanded inside <%= %> <canvas id="draw" height = <%= @dicom.height %> width= <%= @dicom.width %> > Colin> </canvas> > > But, I don''t the expected dimensions. > > As when I calculated the dimensions using this Javascript function: > > I found that the image width and height is 512x512, and the displayed > image is not correct, as when I manually enter the height and width > values in the "Canvas", I get a larger image that the one I''m getting. > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 14:56 UTC
Re: Re: How to access a model method from within a view?
Colin Law wrote:> On 19 September 2010 15:29, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> Frederick Cheung wrote: >>> On Sep 19, 3:11�pm, Abder-Rahman Ali <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>>> </canvas> >>> What''s wrong with <%= some_object.width %> ? >>> >>> Fred >> >> I tried: >> >> <canvas id="draw" height = "@dicom.height" width= "@dicom.width"> > > You have to put the bits of ruby code that you want expanded inside <%= > %> > <canvas id="draw" height = <%= @dicom.height %> width= <%= @dicom.width > %> > > > ColinOh, thansk Colin, I forgot <%= %>. When I do that, I get: Showing C:/Users/Abder-Rahman/Desktop/Research/dcm/app/views/dicoms/show.html.erb where line #2 raised: is not recognized by the ''identify'' command. Either when I write it as: <canvas id="draw" height = <%=-SHQqU27xyw/rDb6q1WGXCQ@public.gmane.org%> width= <%=-Ra1/UcCEv+I@public.gmane.orgdth%> > Or, <canvas id="draw" height = "<%=-SHQqU27xyw/rDb6q1WGXCQ@public.gmane.org%>" width= "<%=-Ra1/UcCEv+JYyr/e4s2GkQ@public.gmane.org%>" > What do you think? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
If this is only in the show method - one record, I assume, why not pass the height and width as instance variables in the method call which are then available in the view? On Sep 19, 10:11 am, Abder-Rahman Ali <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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 viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 15:03 UTC
Re: How to access a model method from within a view?
Bb Serviss wrote:> If this is only in the show method - one record, I assume, why not > pass the height and width as instance variables in the method call > which are then available in the view?Thanks @Bb. How do you think this can be done? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 15:54 UTC
Re: Re: How to access a model method from within a view?
ok, im back. has_attached_file :photo, :styles => { :original => ["100%", :jpg], } <=== this here is incomplete and is you are only having the original image there is no need to specify the style, and paperclip wont convert the image to jpg, also is not good to put convertion in the same thread as the main app. def height() uploaded_file = photo.queued_for_write[:original] dimensions = Paperclip::Geometry.from_file(uploaded_file) <==== is better to save the image in a specific size by doing return dimensions.height :styles=>{:small=>"150x150>",:big=>"900x900>"} end def width() uploaded_file = photo.queued_for_write[:original] dimensions = Paperclip::Geometry.from_file(uploaded_file) <==== is better to save the image in a specific size by doing return dimensions.width :styles=>{:small=>"150x150>",:big=>"900x900>"} end end them you always know the correct size, but anyway your question is wrong as this has nothing to do with models, your height() are unnecesary as you should just save the width and height on the save event as properties. add width and hieght as fields of the table. def before_save baunds = Paperclip::geometry.from_file(uploaded_file(:original)) width = bounds.width height = bounds.height end then instanciate and object and call the properties from it -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 15:58 UTC
Re: Re: How to access a model method from within a view?
" is not recognized by the ''identify'' command." you are running the paperclip on windows , you have to hack it so that the command can be executed by the cmd.exe in this branch is suppose to be fixed http://github.com/ghazel/paperclip.git -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 16:44 UTC
Re: Re: How to access a model method from within a view?
radhames brito wrote:> " is not recognized by the ''identify'' command." > > > you are running the paperclip on windows , you have to hack it so that > the > command can be executed by the cmd.exe > > in this branch is suppose to be fixed > > http://github.com/ghazel/paperclip.gitI think the link is broken? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 16:58 UTC
Re: Re: How to access a model method from within a view?
Thanks @radhames for your thorough explanation. I still have the same issue. I think I may have a problem in making an instantiation. My model now is as follows: class Dicom < ActiveRecord::Base has_attached_file :photo, :styles => { :original => ["100%", :jpg], } def before_save uploaded_file = photo.queued_for_write[:original] dimensions = Paperclip::Geometry.from_file(uploaded_file) height = dimensions.height width = dimensions.width end end And, I have done this in "show.html.erb": <canvas id="draw" height="<%=@dicom.height%>" width="<%=@dicom.width%>">What am I missing? 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 17:11 UTC
Re: Re: Re: How to access a model method from within a view?
did you created the fields in the database? do that and it should work -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 17:20 UTC
Re: Re: Re: How to access a model method from within a view?
and dont forget to add height and width to the attr_accessible list and fix this height = dimensions.height width = dimensions.width to self.height = dimensions.height self.width = dimensions.width also you can remove the style from has_attached_file :photo, :styles => { :original => ["100%", :jpg] , } to has_attached_file :photo and you have an extra comma that does not goes there at the end it should look similar to this has_attached_file :image, :url => "/system/assets/images/:id/:style/:basename.:extension", :path => ":rails_root/public/system/assets/images/:id/:style/:basename.:extension" validates_attachment_presence :image validates_attachment_size :image, :less_than=> 800.kilobytes validates_attachment_content_type :image, :content_type => %r{image/.*} the red charactesr means you should but the size you want there, you can remove validates_attachment_size :image, :less_than=> 800.kilobytes if you dont want to set a limit. /*********************************/ my replies have many typos , some time i write ''user'' instead of ''used'' and ''is'' instead of ''if'' you may want to check that in case something is not clear -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 17:52 UTC
Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> did you created the fields in the database? do that and it should workYes, I have created the fields in the database as follows:> rails script generate migration AddWidthToDicom width:integerAnd,> rails script generate migration AddHeightToDicom height:integerBut, still the same. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 18:00 UTC
Re: Re: Re: Re: How to access a model method from within a view?
sorry im an idiot def after_save uploaded_file = photo.queued_for_write[:original] dimensions = Paperclip::Geometry.from_file(uploaded_file) height = dimensions.height width = dimensions.width end end is after save not before, in the before Paperclip::Geometry.from_file(uploaded_file) does not exist On Sun, Sep 19, 2010 at 1:52 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> radhames brito wrote: > > did you created the fields in the database? do that and it should work > > Yes, I have created the fields in the database as follows: > > > rails script generate migration AddWidthToDicom width:integer > > And, > > > rails script generate migration AddHeightToDicom height:integer > > But, still the same. > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 18:01 UTC
Re: Re: Re: Re: How to access a model method from within a view?
let me go check that because rigth now im telling you everything from memory, ill go see the right way to do it and the reply to you -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 18:06 UTC
Re: Re: Re: Re: How to access a model method from within a view?
Can you wait a while ? im going to make an example project but instead of use dicom image ill use a normal image, i will upload the project to github so you can check it out. ok? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 18:11 UTC
Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> Can you wait a while ? im going to make an example project but instead > of > use dicom image ill use a normal image, i will upload the project to > github > so you can check it out. ok?@radhames, sure, that sounds great. I really appreciate your efforts. Looking forward for your example. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-19 18:12 UTC
Re: Re: Re: Re: Re: How to access a model method from within a view?
i just had lunch, and im going to take a nap after that ill work on it -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 18:17 UTC
Re: Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> i just had lunch, and im going to take a nap after that ill work on itTake your time @radhames. 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Sep-19 20:47 UTC
Re: Re: Re: Re: How to access a model method from within a view?
On 19 September 2010 18:52, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> radhames brito wrote: >> did you created the fields in the database? do that and it should work > > Yes, I have created the fields in the database as follows: > >> rails script generate migration AddWidthToDicom width:integer > > And, > >> rails script generate migration AddHeightToDicom height:integer > > But, still the same.Did you run the migrations? rake db:migrate Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-19 20:50 UTC
Re: Re: Re: Re: How to access a model method from within a view?
Colin Law wrote:> On 19 September 2010 18:52, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> >> But, still the same. > > Did you run the migrations? > rake db:migrate > > ColinYes, I did. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-20 15:38 UTC
Re: Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> i just had lunch, and im going to take a nap after that ill work on itHi @radhames. Have you built up the application yet? Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-20 15:58 UTC
Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
not done yet be ready in an hour, i just arrive at work and have to install rails 3 in this machine, can you wait? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-20 16:17 UTC
Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> not done yet be ready in an hour, i just arrive at work and have to > install > rails 3 in this machine, can you wait?Sure, @radhames. That''s fine. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-20 18:08 UTC
Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
its done im gona upload it to github now, is very basic , tell me any features you wan added, by tomorrow ill add tooltip and other cool thing, also tell me if you want to have galleries per user. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-20 18:11 UTC
Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> its done im gona upload it to github now, is very basic , tell me any > features you wan added, by tomorrow ill add tooltip and other cool > thing, > also tell me if you want to have galleries per user.Thanks a lot @radhames. Appreciate it. Can you give us the link to github? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-20 18:19 UTC
Re: Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
http://github.com/rbritom/Images_handling_examples sorry was uploading and setting up this pc to work with github -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-20 18:28 UTC
Re: Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
there is an error where in the show action it should say width and height and is saiy width and width again -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-20 18:35 UTC
Re: Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> http://github.com/rbritom/Images_handling_examples > > sorry was uploading and setting up this pc to work with githubThanks a lot @radhames. That''s fine. Really helpful. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-20 18:39 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
i screwed up my rsa key and i cant update from this pc, ill fix everything when i get home. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Abder-Rahman Ali
2010-Sep-20 18:43 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: How to access a model method from within a view?
radhames brito wrote:> i screwed up my rsa key and i cant update from this pc, ill fix > everything > when i get home.That''s fine. Appreciate your efforts. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.