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

WIP: spree 2.3 compat fixes #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/models/spree/address_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Spree::Address.class_eval do
belongs_to :user, :class_name => Spree.user_class.to_s

attr_accessible :user_id, :deleted_at

def self.required_fields
validator = Spree::Address.validators.find{|v| v.kind_of?(ActiveModel::Validations::PresenceValidator)}
Expand Down
22 changes: 22 additions & 0 deletions app/models/spree/attribute_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Spree::PermittedAttributes.class_eval do
self.user_attributes << [
addresses_attributes: [
:id,
:firstname,
:lastname,
:address1,
:address2,
:city,
:state_id,
:zipcode,
:country_id,
:phone,
:_destroy
]
]
self.checkout_attributes << [
:bill_address_id,
:ship_address_id
]

end
2 changes: 1 addition & 1 deletion app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Spree::Order.class_eval do
attr_accessible :bill_address_id, :ship_address_id
# attr_accessible :bill_address_id, :ship_address_id
before_validation :clone_shipping_address, :if => "Spree::AddressBook::Config[:disable_bill_address]"

def clone_shipping_address
Expand Down
3 changes: 2 additions & 1 deletion app/models/spree/user_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Spree.user_class.class_eval do
has_many :addresses, :conditions => {:deleted_at => nil}, :order => "updated_at DESC", :class_name => 'Spree::Address'
has_many :addresses, :class_name => 'Spree::Address'
accepts_nested_attributes_for :addresses, allow_destroy: true
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class InstallGenerator < Rails::Generators::Base
class_option :auto_run_migrations, :type => :boolean, :default => false

def add_javascripts
append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_address_book\n"
append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_address_book\n"
#append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_address_book\n"
#append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_address_book\n"
end

def add_stylesheets
inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_address_book\n", :before => /\*\//, :verbose => true
inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_address_book\n", :before => /\*\//, :verbose => true
#inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_address_book\n", :before => /\*\//, :verbose => true
#inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_address_book\n", :before => /\*\//, :verbose => true
end

def add_migrations
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/spree_address_book/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module SpreeAddressBook
module Generators
class InstallGenerator < Rails::Generators::Base
def add_javascripts
append_file "app/assets/javascripts/store/all.js", "//= require store/spree_address_book\n"
#append_file "app/assets/javascripts/store/all.js", "//= require store/spree_address_book\n"
end

def add_stylesheets
inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_address_book\n", :before => /\*\//, :verbose => true
#inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_address_book\n", :before => /\*\//, :verbose => true
end

def add_migrations
Expand Down
2 changes: 1 addition & 1 deletion spree_address_book.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'

s.add_dependency 'spree_core', '~> 2.0.3'
s.add_dependency 'spree_core', '~> 2.3.0'

s.add_development_dependency 'capybara', '~> 2.1'
s.add_development_dependency 'coffee-rails'
Expand Down