Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datamapper support #472

Merged
merged 10 commits into from
Jan 6, 2014
Merged

Datamapper support #472

merged 10 commits into from
Jan 6, 2014

Conversation

fzagarzazu
Copy link
Contributor

DataMapper Support

Passed tests with DM adapter: dm-mysql-adapter .

Please see notes in README file, code review and feedback appreciated.

gem 'data_mapper'
gem 'dm-sqlite-adapter'
gem 'dm-mysql-adapter'
gem 'dm-redis-adapter'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need redis adapter here?
As mysql database is created on Travis, do we need dm-sqlite as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The adapters for redis and sqlite are there because I was using them for testing during development, I left the redis setup commented out in spec/orm/datamapper.rb just in case somebody wanted to use it.
We can remove them.

@kirs
Copy link
Collaborator

kirs commented Oct 30, 2013

Now it's better 😉
But I still don't feel comfortable to override the save method inside the gem.

What do you think about writing method like update_many_attributes (which is especially to be capable with all ORMs), but for saving without validation?

@fzagarzazu
Copy link
Contributor Author

Something like this ?

          # lib/sorcery/model/adapters/datamapper.rb 
          def sorcery_save(mthd, options = {})
            if options.key?(:validate) && ! options[:validate]
              save!
            else
              save
            end
          end
         # other adapters
          def sorcery_save(mthd, options = {})
            self.send(mthd, options)
          end

@kirs
Copy link
Collaborator

kirs commented Oct 30, 2013

I'm not sure we need mthd (it stands method_name as I understood), but you've got the main idea.

@kirs
Copy link
Collaborator

kirs commented Dec 17, 2013

Could you rebase it, please?

@fzagarzazu
Copy link
Contributor Author

Updated, expected to work with Rails 3, datamapper is not being actively developed.

@kirs
Copy link
Collaborator

kirs commented Dec 19, 2013

That means after merging Datamapper integration we'll always have red status on Travis. Any ideas how to avoid it?

@fzagarzazu
Copy link
Contributor Author

Added an exclusion filter to skip DM tests

@moonglum moonglum mentioned this pull request Jan 4, 2014
kirs added a commit that referenced this pull request Jan 6, 2014
@kirs kirs merged commit db47df2 into NoamB:master Jan 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants