Scenic在Rails中版本化数据库视图脚本。它为ActiveRecord :: Migration添加方法,以在Rails中用Migration版本方式来创建和管理数据库视图。 https://github.com/scenic-views/scenic 使用Scenic,您可以: 将SQL视图的强大功能带到Rails应用程序,而无需将架构格式切换为SQL。 作为额外的好处,您可以在SQL文件中定义视图的结构,这意味着您可以在您选择的编辑器中获得完整的SQL语法突出显示,并且可以在开发期间轻松地在数据库控制台中测试SQL。 提供了版本控制视图的约定,可使您的迁移历史记录在多个环境中保持一致且可逆,并避免在迁移过程中复制SQL字符串或者遗漏执行视图脚本。 Scenic内置适配器支持PostgreSQL。 其他关系型数据库适配器是可配置的(参见Scenic :: Configuration),并且具有其他gem可以提供的最小接口(参见Scenic :: Adapters :: Postgres)。 官方README.md文档介绍如何创建视图脚本,更新或回滚视图,也介绍如何创建和使用view-backed models,以及使用过程中的常见问题(视图缺少主键、定义过期失效等)。最后说明内置PostgreSQL适配器的原因,同时推荐其他关系型数据库适配器。 下面是一个简单的使用例子: 假如想要创建一个名为search_results的视图,您可以使用以下命令创建迁移和相应的视图定义文件: $ rails generate scenic:view search_results create db/views/search_results_v01.sql create db/migrate/[TIMESTAMP]_create_search_results.rb 编辑 db/views/search_results_v01.sql文件,用SQL语句定义您的视图。比如: SELECT statuses.id AS searchable_id, ‘Status’ AS searchable_type, comments.body AS term FROM statuses JOIN comments ON statuses.id = comments.status_id UNION SELECT… Continue Reading Ruby Gem – scenic-views/scenic: Versioned database views for Rails

Original: https://github.com/adamcooke/staytus Staytus提供页面快速展示和发布Web服务状态和处理进展。同时提供以下功能: 1. 美观和响应的界面 2. 跟踪问题,并随着问题的进展不断发布更新 3. 发布您的维护窗口,在状态站点上公布 4. 允许访问者通过电子邮件订阅,在添加新问题或维护会话时自动通知他们 5. 包含一个JSON API,允许更新外部应用程序和源的状态 6. 与同事协助添加新的更新,以确保始终通知客户 Staytus http://staytus.co/ Staytus is a complete solution for publishing the latest information about any issues with your web applications, networks or services. Along with absolutely beautiful public & admin interfaces, Staytus is a powerful tool… Continue Reading Rails – adamcooke/staytus: 💡 An open source solution for publishing the status of your services

ActiveRecord::MTI ActiveRecord support for PostgreSQL’s native inherited tables (multi-table inheritance) Compatible with ActiveRecord 4.0, 4.1, 4.2, 5.0, 5.1 Confirmed production use in 4.2 1. Usage Add this line to your application’s Gemfile: gem ‘active_record-mti’ And then execute: $ bundle Or install it yourself as: $ gem install active_record-mti 2. Application… Continue Reading Ruby Gem – TwilightCoders/active_record-mti

The application allows a user to log in to either the main site (http://lvh.me:3000/) or a user site (http://myname.lvh.me:3000/). Logging in creates a user session. In its current form, the application maintains separate and independent user sessions for the main site and each subdomain. That’s because session data for each… Continue Reading Allow Rails Sessions To Be Shared Across Subdomains

1. 问题描述 今天有一台服务器运行Rails项目遇到MySQL报错Character set ‘utf8mb4’ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml’ file 详细异常如下: [[email protected] production]$ rails c :linux Character set ‘utf8mb4’ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml’ file /home/blogbin/.rvm/gems/[email protected]/gems/mysql2-0.3.20/lib/mysql2/client.rb:70:in `connect’: Can’t initialize character set utf8mb4 (path:… Continue Reading Rails项目遇到MySQL报错Character set ‘utf8mb4’ is not a compiled character set

原文:Active Record Transactions 作者:ioquatix 转自:https://github.com/ioquatix/covered Ruby on Rails 5.2.0 ModuleActiveRecord::Transactions::ClassMethods activerecord/lib/active_record/transactions.rb Active Record Transactions Transactions are protective blocks where SQL statements are only permanent if they can all succeed as one atomic action. The classic example is a transfer between two accounts where you can only have a deposit if the withdrawal… Continue Reading [Reproduce]Active Record Transactions

比较:OpenProject和Redmine OpenProject历史上是Redmine的继承者,但使用更现代的技术和更加用户友好的最新设计。 OpenProject不是传统的Web应用程序,而是一个现代的单页面应用程序。用户可以通过单击创建和编辑问题,而Redmine需要多个步骤才能完成相同的操作。将新成员添加到项目中也是如此:在Redmine中,您需要在管理屏幕中创建新用户。 然后,您需要将用户添加到项目中。 OpenProject允许一步完成。 OpenProject还提供了一个现代的动态甘特图,非常人性化,并集成在工作包页面中。 另一方面,Redmine包含旧的时间轴,需要许多页面重新加载才能更新。 https://www.openproject.org/collaboration-software-features/   Original: https://github.com/opf/openproject OpenProject   OpenProject is a web-based project management software. Its key features are: Project planning and scheduling Product roadmap and release planning Task management and team collaboration Agile and Scrum Time tracking, cost reporting and budgeting Bug tracking Wikis Forums… Continue Reading [Reproduce]OpenProject is a web-based project management software

原文:Rails transactions: The Complete Guide 作者:Mark Daggett 转自:http://markdaggett.com/blog/2011/12/01/transactions-in-rails/ Transactions in Rails DEC 1ST, 2011 Recently I was tasked to write tests for the transactions of an existing application. This gave me the opportunity to learn more about the codebase, while also improving the test coverage. Generally, most of the transaction… Continue Reading [Reproduce]Transactions in Rails