Giter Site home page Giter Site logo

hanami / bookshelf Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 14.0 139 KB

Hanami "Getting Started" project

Home Page: https://guides.hanamirb.org/introduction/getting-started/

License: MIT License

Ruby 95.94% HTML 4.06%
ruby hanami getting-started bookshelf

bookshelf's Introduction

Hanami Bookshelf (an example application)

This repository is the result of going through Hanami's Getting Started guide.

It exists as an example application.

We are only interested in Pull Requests keeping this application in sync with the Getting Started guide. That is, we do not want to add any features here to build out this application.

Usage

Hanami v1.3 supports Ruby (MRI) 2.3, < 3.0.

(Hanami v2.0 will support Ruby 3.0)

git clone [email protected]:hanami/bookshelf.git hanami-bookshelf
cd hanami-bookshelf
bundle install
bundle exec hanami db prepare
bundle exec hanami server # visit http://localhost:2300/books/new

This repository is intended to be used for instructional purposes.

For example, if you're writing a blog post explaining how to add some library to a Hanami application, rather than writing your own trivial application, you can instruct readers to clone this repository as a starting point. This should make it easier to write guides for Hanami applications.

Code of Conduct

We have a Code of Conduct that all community members are expected to adhere to.

Contributing

  1. Fork it ( https://github.com/hanami/bookshelf )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Licensing

Released under MIT License.

bookshelf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bookshelf's Issues

Mysql2::Error: Table 'bookshelf_development.schema_migrations' doesn't exist

I'm going through the getting started guide.
On chapter "Modeling Our Data With Entities" I execute following commands:

My-iMac:bookshelf myname$ bundle exec hanami generate model book

      create  lib/bookshelf/entities/book.rb
      create  lib/bookshelf/repositories/book_repository.rb
      create  db/migrations/20170516071624_create_books.rb
      create  spec/bookshelf/entities/book_spec.rb
      create  spec/bookshelf/repositories/book_repository_spec.rb

My-iMac:bookshelf myname$ bundle exec hanami db prepare

[hanami] [INFO] (0.000079s) SET @@wait_timeout = 2147483
[hanami] [INFO] (0.000119s) SET SQL_AUTO_IS_NULL=0
[hanami] [ERROR] Mysql2::Error: Table 'bookshelf_development.schema_migrations' doesn't exist: SELECT NULL AS `nil` FROM `schema_migrations` LIMIT 1
[hanami] [INFO] (0.060494s) CREATE TABLE `schema_migrations` (`filename` varchar(255) PRIMARY KEY)
[hanami] [ERROR] Mysql2::Error: Table 'bookshelf_development.schema_info' doesn't exist: SELECT NULL AS `nil` FROM `schema_info` LIMIT 1
[hanami] [INFO] (0.000283s) SELECT `filename` FROM `schema_migrations` ORDER BY `filename`
[hanami] [INFO] Begin applying migration 20170516071624_create_books.rb, direction: up
[hanami] [INFO] (0.015804s) CREATE TABLE `books` (`id` integer PRIMARY KEY AUTO_INCREMENT, `title` varchar(255) NOT NULL, `author` varchar(255) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL)
[hanami] [INFO] (0.002129s) INSERT INTO `schema_migrations` (`filename`) VALUES ('20170516071624_create_books.rb')
[hanami] [INFO] Finished applying migration 20170516071624_create_books.rb, direction: up, took 0.018571 seconds

If I destroy the generated model, bundle exec hanami db prepare works properly (which is normal, the schema_migrations isn't being called as there are no migrations).

Why we must duplicate params validation in view specs?

bookshelf/spec/web/views/books/new_spec.rb

Maybe we can access them from create action or separate in another file which can be required in both spec and action?

In this way is possible situation when we change params validation in action but not change in this spec. Then will get a passing spec but uncovered action behaviour.

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.