Sha256: 5df499962217bb1743e31bd7c9b2b1318781c2695580ebc7b1a85c69a252aa0a
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module Pages class RailsIntegration < ApplicationPage def template render Layout.new(title: "Ruby on Rails integration") do render Markdown.new(<<~MD) # Ruby on Rails integration ## Installation To install Phlex into your Rails application, you can run the `bin/rails phlex:install` command. ## View generator You can generate new views with the `rails g phlex:view` command. For example, running `rails g phlex:view Card` will create the following file: MD render CodeBlock.new(<<~RUBY, syntax: :ruby) # app/views/card.rb module Views class Card < ApplicationView def template end end end RUBY render Markdown.new(<<~MD) ## Helpers You can use the `helpers` proxy to access helpers within your views. For example, you can use the `#t` helper for translations: MD render CodeBlock.new(<<~RUBY, syntax: :ruby) # app/views/hello.rb module Views class Hello < ApplicationView delegate :t, to: :helpers def template h1 do t "hello" end end end end RUBY end end end end
Version data entries
7 entries across 7 versions & 1 rubygems