Image I have this model: Class Post < ActiveRecord::Base validates_presence_of :date validates_presence_of :title validates_presence_of :text end But now I want to do the same as this page : http://www.tamarawobben.nl/dagboek/2005/09/2/ So text a image and the rest of the text. What''s the best way to do this in ROR. Must I made for every post a seperate layout which will contain the image of the page if there is a image on that page or is there a better way. Roelof -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/w2-GHFfXmg0J. For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Sep 5, 2012 at 12:38 PM, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> Must I made for every post a seperate layout which will contain the image of > the page if there is a image on that page or is there a better way.Think about it: do you need a separate layout for each page because it has different textual content? No? What allows images to appear in web pages? A little bit of text that indicates the source of the image file itself. Why would that second kind of text require anything different? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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 https://groups.google.com/groups/opt_out.
Op woensdag 5 september 2012 22:03:28 UTC+2 schreef Hassan Schroeder het volgende:> > On Wed, Sep 5, 2012 at 12:38 PM, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > > Must I made for every post a seperate layout which will contain the > image of > > the page if there is a image on that page or is there a better way. > > Think about it: do you need a separate layout for each page because > it has different textual content? No? > > What allows images to appear in web pages? A little bit of text that > indicates the source of the image file itself. > > Why would that second kind of text require anything different? > > -- > Hassan Schroeder ------------------------ hassan.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:> > http://about.me/hassanschroeder > twitter: @hassan >I don''t know. I know if I make create function with this model. I can type a lot of text. But as far as I know I cannot insert a image at a particular place. That''s why i asked here how to do it. Roelof -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/NV2v_h8yZo4J. For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Sep 5, 2012 at 1:45 PM, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> But as far as I know I cannot insert a image at a particular place.What exactly do you mean by "at a particular place"? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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 https://groups.google.com/groups/opt_out.
Op woensdag 5 september 2012 22:55:03 UTC+2 schreef Hassan Schroeder het volgende:> > On Wed, Sep 5, 2012 at 1:45 PM, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > > But as far as I know I cannot insert a image at a particular place. > > What exactly do you mean by "at a particular place"? > > -- > Hassan Schroeder ------------------------ hassan.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:> > http://about.me/hassanschroeder > twitter: @hassan >I mean that I choose the place for the image. So at all the places there is no fixed place for the image, See for examples : http://www.tamarawobben.nl/dagboek/2005/04/1/ http://www.tamarawobben.nl/dagboek/2005/09/2/ http://www.tamarawobben.nl/dagboek/2005/09/6/ Roelof -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9garX8mlgZwJ. For more options, visit https://groups.google.com/groups/opt_out.
On Sep 6, 2012, at 1:20 AM, roelof wrote:> > Op woensdag 5 september 2012 22:55:03 UTC+2 schreef Hassan Schroeder het volgende: > On Wed, Sep 5, 2012 at 1:45 PM, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > But as far as I know I cannot insert a image at a particular place. > > What exactly do you mean by "at a particular place"? > > -- > Hassan Schroeder ------------------------ hassan.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > I mean that I choose the place for the image. > So at all the places there is no fixed place for the image, > See for examples : > http://www.tamarawobben.nl/dagboek/2005/04/1/ > http://www.tamarawobben.nl/dagboek/2005/09/2/ > http://www.tamarawobben.nl/dagboek/2005/09/6/ > > Roelof > >It sounds like you could use a WYSIWYG or "rich text" editor in your form, so you could create HTML for your content area. I have used the CK Editor in the past (there''s several Rails gems for it) to do just this. It includes an asset upload system, so you could upload a photo and "place" it in your layout. That of course requires a whole other MVC to manage, but the gem includes rake tasks to build that out for you. Walter> > > > > -- > 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. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9garX8mlgZwJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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 https://groups.google.com/groups/opt_out.
On Wed, Sep 5, 2012 at 10:20 PM, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> I mean that I choose the place for the image. > So at all the places there is no fixed place for the image, > See for examples :Forget the examples; if you can''t *describe* the outcome you want, you can''t program it. Create a static web page with markup that demonstrates your result. Then think about how you would create that page programmatically. Hint: Is the image tag inserted at a random point? Or is it perhaps inserted between paragraphs of the text? After a certain number of characters/words? If the location differs from post to post, then it would seem that the image source and location within the text are both attributes of that post, yes? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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 https://groups.google.com/groups/opt_out.
Op donderdag 6 september 2012 15:04:48 UTC+2 schreef Hassan Schroeder het volgende:> > On Wed, Sep 5, 2012 at 10:20 PM, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > > I mean that I choose the place for the image. > > So at all the places there is no fixed place for the image, > > See for examples : > > Forget the examples; if you can''t *describe* the outcome you want, > you can''t program it. > > Create a static web page with markup that demonstrates your result. > Then think about how you would create that page programmatically. > > Hint: Is the image tag inserted at a random point? Or is it perhaps > inserted between paragraphs of the text? After a certain number of > characters/words? > > If the location differs from post to post, then it would seem that the > image source and location within the text are both attributes of that > post, yes? > > Most of the images are between paragraphs of the text. If not there are > above or under all the text. > You mean with the last paragraph that the name and place are attributes of > the class article. > But how can I then make the place. Must I use a x and y or can I use words > to describe what I want. > >Roelof -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KrggeHdAOhwJ. For more options, visit https://groups.google.com/groups/opt_out.
On Thu, Sep 6, 2012 at 6:48 AM, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:>> But how can I then make the place. Must I use a x and y or can I use words >> to describe what I want.I''m not sure I understand the question. But if you want to e.g. have a picture between paragraphs 2 and 3, just write a helper method to split the text there. Then your view looks like <%= article_part[0] %> <%= image_tag ... %> <%= article_part[1] %> Done. :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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 https://groups.google.com/groups/opt_out.
Op donderdag 6 september 2012 15:57:09 UTC+2 schreef Hassan Schroeder het volgende:> > On Thu, Sep 6, 2012 at 6:48 AM, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > >> But how can I then make the place. Must I use a x and y or can I use > words > >> to describe what I want. > > I''m not sure I understand the question. But if you want to e.g. have > a picture between paragraphs 2 and 3, just write a helper method to > split the text there. Then your view looks like > > <%= article_part[0] %> > <%= image_tag ... %> > <%= article_part[1] %> > > Done. :-) > -- > Hassan Schroeder ------------------------ hassan.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:> > http://about.me/hassanschroeder > twitter: @hassan >Thanks, I now diving into the helper documentation how to do this ? I think I have a too difficult problem for learning Ruby on Rails. Roelof -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/R57PUSX15loJ. For more options, visit https://groups.google.com/groups/opt_out.
On 6 September 2012 15:25, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> > Op donderdag 6 september 2012 15:57:09 UTC+2 schreef Hassan Schroeder het > volgende: >> >> On Thu, Sep 6, 2012 at 6:48 AM, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> >> >> But how can I then make the place. Must I use a x and y or can I use >> >> words >> >> to describe what I want. >> >> I''m not sure I understand the question. But if you want to e.g. have >> a picture between paragraphs 2 and 3, just write a helper method to >> split the text there. Then your view looks like >> >> <%= article_part[0] %> >> <%= image_tag ... %> >> <%= article_part[1] %> >> >> Done. :-) >> -- >> Hassan Schroeder ------------------------ hassan.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> http://about.me/hassanschroeder >> twitter: @hassan > > > > > Thanks, > I now diving into the helper documentation how to do this ? > I think I have a too difficult problem for learning Ruby on Rails.Possibly you should learn a bit more about html, css and probably javascript. Once you understand more about how web pages function then you can move on to RoR. 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 https://groups.google.com/groups/opt_out.