Rails 7 with React, TailwindCSS and Bootstrap 5 Example – Rails 7.0.0 – SQLite – Node v14.15.0 – NPM 6.14.8 – Yarn 1.22.17 – TailwindCSS 3 – Bootstrap 5 – React 17.0.2 Setup Rails 7 project Create Rails 7 project rails _7.0.0_ new Rails7WithReactTailwindCSSBootstrapExample -j esbuild -c tailwind Install node packages yarn add @tailwindcss/forms @tailwindcss/typography… Read More


Rails Custom View Scaffold Example Customize view scaffolding template using Bootstrap 5 We will do in this example: – Create new new the Ruby on Rails project using version 6.1.1 – Locate Railties path – Customize the scaffold template – Add Boostrap version 5.0.0-beta1 – Generate scaffold for category and article – Run project and… Read More


Highlighting text in Ruby ### Start code def highlight(text,search_string) keywords = search_string.squeeze.strip.split(” “).compact.uniq matcher = Regexp.new( ‘(‘ + keywords.join(“|”) + ‘)’ ) highlighted = text.gsub(matcher) { |match| “<b>#{match}</b>” } return highlighted end text = “This is an example of the text.” search = “example text” puts highlight(text,search) # => This is an <b>example</b> of the… Read More