Last active
January 10, 2022 20:39
-
-
Save rothfield/7be6b978f67b6a7764442fd4650a3098 to your computer and use it in GitHub Desktop.
Rails7 actionscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps for Actiontext demo | |
------------------------- | |
gem install rails -v 7.0.1 | |
rails new actiontext_demo -v 7.0.1 | |
cd actiontext_demo | |
bundle | |
which rails | |
#/home/john/projects/demo4/bin/rails | |
PATH should include ./bin EARLY in the path. | |
------------------------------------------- | |
echo $PATH | |
# required | |
rails importmap:install | |
# required | |
rails action_text:install | |
# required. installs minimagick etc | |
bundle | |
# scaffold posts | |
rails g scaffold post title:string content:text | |
rails db:migrate | |
# Activate rich text for post.content | |
vi app/models/post.rb | |
#add | |
has_rich_text :content | |
# using sed | |
sed -i '2 i \ \ has_rich_text :content' app/models/post.rb | |
vi app/views/posts/_form.html.erb | |
# change form.text_area to form.rich_text_area | |
# using sed | |
sed -i 's/text_area/rich_text_area/g' app/views/posts/_form.html.erb | |
# start server | |
bin/rails s -b 0.0.0.0 | |
# open | |
http://localhost:3000/posts/new | |
Try adding an image to the content and click Update Post |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment