-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/rails 7 and adding features (#3)
* Add support for Rails 7. Update dependencies and namespacing for Faraday errors. Bump version file. Remove codeclimate dependency. * Add ActiveModel::Type where they can be inferred from salesforce when generating model files. * Add namespace command line option. Call `classify` on class name to remove underscores. Remove unneeded monkey patch and call `underscore` from ActiveSupport. * Set the `table_name` in the model generator. * Add `has_one` association and a ProjectionBuilder for it. * Move towards using the `attributes` from ActiveModel rather than custom ones. * Add get/set via `[]` and `[]=` just like in ActiveRecord. * Sort the attributes by `:name` so they are easier to read after running the model generator. * Add a couple more delegators. * Exclude vendor and spec directories from SimpleCov configuration. * Update CHANGELOG for new release.
- Loading branch information
Showing
20 changed files
with
290 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in active_force.gemspec | ||
gem "codeclimate-test-reporter", group: :test, require: nil | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module ActiveForce | ||
module Association | ||
class HasOneAssociation < Association | ||
private | ||
|
||
def default_foreign_key | ||
infer_foreign_key_from_model @parent | ||
end | ||
|
||
def define_relation_method | ||
association = self | ||
_method = @relation_name | ||
@parent.send :define_method, _method do | ||
association_cache.fetch(_method) do | ||
association_cache[_method] = association.relation_model.to_s.constantize.find_by(association.foreign_key => self.id) | ||
end | ||
end | ||
|
||
@parent.send :define_method, "#{_method}=" do |other| | ||
value_to_set = other.nil? ? nil : self.id | ||
# Do we change the object that was passed in or do we modify the already associated object? | ||
obj_to_change = value_to_set ? other : self.send(association.relation_name) | ||
obj_to_change.send "#{ association.foreign_key }=", value_to_set | ||
association_cache[_method] = other | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module ActiveForce | ||
VERSION = "0.8.3" | ||
VERSION = "0.9.0" | ||
end |
Oops, something went wrong.