Ask A Question

Notifications

You’re not receiving notifications from this thread.

Creating a Blog with Images ins Posts

Sebastian asked in Rails

Hey folks,
iam very new to Ruby on Rails but iam trying to improove my skills.
I want to write a little blog application on rails where i should have the ability to create posts. I followed a pretty nice guide on youtube so i have set up a blog which works okay for posts in general. i implemented tinymce as texteditor.
i really want to have the ability to upload images in my posts, so when i ll upload a post that i can fill in a few images. AS seemed to be a good solution, but i am only able to attach files after posts not in my posts. i also tried trix and shrine but somehow its not working. maybe cause my postmodel isnt right therefore? i have a t.text :content and t.string :title there.

is there an opportunity to insert images IN posts with AS?

my main goal is and my pretty naiv idea was to create posts with images and have a page called image gallery where every image is automatically added so you can see an overview over all images.
on the home i wanted to have images as kind of "teasers" for my posts. so the image has a description and a title and when you vlick on it you get to the single post view.
is that even realistic? i am really stuck right now which is sad cause its totally frustrating. iam very pleased for every tip! thank you so much!

Reply

You can use a WYSIWYG editor with an ability to insert images.

First go Here
https://github.com/spohlenz/tinymce-rails
Then Here
https://codepen.io/nirajmchauhan/pen/EjQLpV

Reply

Thank you for that source! Where do i have to fill this code in exactly? Is it enough to just add the css and the js to the tinymce.js and css? And how do i have to fill in the html?
In addition to that do i need something like shrine or is AS enough for my goals?

Reply

What version of Rails are you using?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.