Git Product home page Git Product logo

turbo-rails-example's Introduction

README

INFORMATION

This is a project example on how to use turbo on rails

CONFIG

The setups steps expect following tools installed on the system.

  • RVM
  • Ruby 3.1.2
  • Postgresql

1. Config the credentials

EDITOR=vim rails credentials:edit

Copy the app/config/credentials.yml.example content into credentials file, and replace the database password and secret key base

2. Setup project

./bin/setup

2. Launch project

./bin/dev

3. Generate data

rails db:seed

4. Config database test

RAILS_ENV=test rails db:prepare

5. Launch tests

rails test:system

Turbo notes

Turbo Stream

Remove a Turbo Frame

turbo_stream.remove

Insert a Turbo Frame at the beginning/end of a list

turbo_stream.append
turbo_stream.prepend

Insert a Turbo Frame before/after another Turbo Frame

turbo_stream.before
turbo_stream.after

Replace or update the content of a Turbo Frame

turbo_stream.update
turbo_stream.replace

turbo-rails-example's People

Contributors

acasaism avatar

Stargazers

 avatar

Watchers

 avatar

turbo-rails-example's Issues

TEst

Hi, this error is caused by how cancancan works, check this

My temporary solution for this problem is as follows:

module Spree
  module PermissionSets
    class RestrictedStockManagement < PermissionSets::Base
      def activate!
        can :manage, Spree::StockItem, stock_location_id: location_ids
        cannot :read, StockLocation, active: true
        can :read, Spree::StockLocation, id: location_ids
      end

      private

      def location_ids
        @ids ||= user.stock_locations.pluck(:id)
      end
    end
  end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.