fix issue #115 + clean code + exporting a site works now with ruby 1.8.7
This commit is contained in:
parent
45ff488ae8
commit
47088f9b0e
@ -4,18 +4,17 @@ module Admin
|
|||||||
sections 'settings'
|
sections 'settings'
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@membership = current_site.memberships.build(params[:membership])
|
resource.role = 'author' # force author by default
|
||||||
@membership.role = 'author' # force author by default
|
|
||||||
|
|
||||||
case @membership.process!
|
case resource.process!
|
||||||
when :create_account
|
when :create_account
|
||||||
redirect_to new_admin_account_url(:email => @membership.email)
|
redirect_to new_admin_account_url(:email => resource.email)
|
||||||
when :save_it
|
when :save_it
|
||||||
respond_with @membership, :location => edit_admin_current_site_url
|
respond_with resource, :location => edit_admin_current_site_url
|
||||||
when :error
|
when :error
|
||||||
respond_with @membership, :flash => true
|
respond_with resource, :flash => true
|
||||||
when :already_created
|
when :already_created
|
||||||
respond_with @membership, :alert => t('flash.admin.memberships.create.already_created'), :location => edit_admin_current_site_url
|
respond_with resource, :alert => t('flash.admin.memberships.create.already_created'), :location => edit_admin_current_site_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -211,7 +211,11 @@ module Locomotive
|
|||||||
end
|
end
|
||||||
|
|
||||||
def extract_attributes(object, fields)
|
def extract_attributes(object, fields)
|
||||||
object.attributes.select { |k, v| fields.include?(k) }.delete_if { |k, v| v.blank? }
|
if RUBY_VERSION =~ /1\.9/
|
||||||
|
object.attributes.select { |k, v| fields.include?(k) }
|
||||||
|
else
|
||||||
|
object.attributes.reject { |k, v| !fields.include?(k) }
|
||||||
|
end.delete_if { |k, v| v.blank? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def pages_folder
|
def pages_folder
|
||||||
|
@ -29,8 +29,6 @@ module Locomotive
|
|||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
self.log "!ERROR! = #{e.message}, #{asset_path}"
|
self.log "!ERROR! = #{e.message}, #{asset_path}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# site.reload
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user