GithubHelp home page GithubHelp logo

merb_sequel's Introduction

merb_sequel

A plug-in for the Merb framework that provides support for Sequel models.

If you use my fork on github.com/pk/merb_sequel please use again the official repository on github.com/merb/merb_sequel. I’m now updating the official repository.

Plug-in is compatible with Merb 0.9.9 and higher and Sequel 2.7.0 and higher including 2.x.x and 3.x.x.

Any issues please report to https://merb.lighthouseapp.com/projects/7588-merb-plugins.

Install

Since 1.0.9 you can install official Merb gem:

gem install merb_sequel –source gemcutter.org

Following gems are RETIRED!!!

Since version 1.0.6 I’ve moved gem hosting to Gemcutter. So now you need to install gem with:

gem install pk-merb_sequel –source gemcutter.org

For versions <= 1.0.5 I used GitHub:

gem install pk-merb_sequel –source gems.github.com

Merb < 1.1

Add merb_sequel as a dependency to your config/dependencies.rb:

dependency ‘merb_sequel’

Merb >= 1.1, add it as a dependency to your Gemfile:

gem ‘merb_sequel’

Add Sequel as you ORM of choice to init.rb:

use_orm :sequel

Merb >= 1.2, add it as a dependency to your Gemfile:

gem ‘merb_sequel’

To activate the gem and set all needed to use Sequel just use:

require ‘merb_sequel’

Compatibility

Ruby 1.8.7:

Sequel 2.11.0

All pass

Sequel 2.12.0

All pass

Sequel 3.0.0

All pass

Sequel 3.5.0

All pass

Sequel 3.6.0

All pass

Ruby 1.9.1:

Sequel 2.11.0

All pass

Sequel 2.12.0

All pass

Sequel 3.0.0

All pass

Sequel 3.5.0

All pass

Sequel 3.6.0

All pass

ActiveModel compatibility

In Merb > 1.0.13 we use ActiveModel interface for the ORM plugins. merb_sequel now supports this for all versions of Sequel by including compatibilit layers by default or loading active model plugin when using Sequel > 3.5.0

You can use configuration to not load compatibility layer: Merb::Plugins.config[:load_activemodel_compatibility] = false

RSpec transactional examples

If you want to cut significantly runtime of your test suite which is using Sequel you can enable transactional examples. Just add following line to your spec_helper.rb or any spec you want to be transactional:

require 'merb_sequel/rspec/sequel'

Now each example is wrapped in a Sequel transaction and when example finishes Sequel::Error::Rollback is raised which cause transaction to rollback.

Connection options & Settings

Settings:

  • :load_activemodel_compatibility. By default is set to true. If set to false, ActiveModelCompatibility is not loaded.

Merb Sequel plug-in uses config/database.yml for connection configuration.

Options are:

  • adapter. :sqlite is assumed by default.

  • database, default is “hey_dude_configure_your_database”. In case of SQLite this should be either :memory: or file path for SQLite.

  • db_type: default is nil. Use “mssql” to connect to MSSQL using ODBC.

  • encoding or charset, default is utf8.

  • host. localhost is assumed by default.

  • logger default is Merb.logger

  • password. WARNING: default password is an empty string.

  • socket Use socket to connect to DB.

  • username or user, default is an empty string

Generators

After you install the plug-in, merb-gen can generate Sequel models for you:

merb-gen model --orm=sequel Article

same with the resources

merb-gen resource --orm=sequel Article

Note that if you have specified that you use Sequel in init.rb or environment specific init file (for instance, environments/development.rb) via use_orm :sequel, you don’t need to specify –orm option explicitly when using merb-gen.

Contributors

Originally written by Duane Johnson (canadaduane at gmail.com).

Contributions by:

  • Wayne E. Seguin

  • Lance Carlson

  • Jacob Dunphy

  • Lori Holden

  • Pavel Kunc

  • e-mac

  • Piotr Usewicz

Maintained by Pavel Kunc (pavel.kunc at gmail.com)

merb_sequel's People

Contributors

pk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

merb_sequel's Issues

Session store doesn't work in Ruby 1.9.1

On Ruby 1.9.1 session store doesn't correctly store the value of the session. After a bit of digging it seems that there is a problem with the Marshaling of the session data to the database.

It's probably related to the string encoding since we connects to the database in UTF-8 but strings from the Marshal are in US-ASCII.

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.