fix issue #115 + clean code + exporting a site works now with ruby 1.8.7

This commit is contained in:
did 2011-07-19 14:52:02 +02:00
parent 45ff488ae8
commit 47088f9b0e
3 changed files with 11 additions and 10 deletions

View File

@ -4,18 +4,17 @@ module Admin
sections 'settings'
def create
@membership = current_site.memberships.build(params[:membership])
@membership.role = 'author' # force author by default
resource.role = 'author' # force author by default
case @membership.process!
case resource.process!
when :create_account
redirect_to new_admin_account_url(:email => @membership.email)
redirect_to new_admin_account_url(:email => resource.email)
when :save_it
respond_with @membership, :location => edit_admin_current_site_url
respond_with resource, :location => edit_admin_current_site_url
when :error
respond_with @membership, :flash => true
respond_with resource, :flash => true
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

View File

@ -211,7 +211,11 @@ module Locomotive
end
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
def pages_folder

View File

@ -29,8 +29,6 @@ module Locomotive
rescue Exception => e
self.log "!ERROR! = #{e.message}, #{asset_path}"
end
# site.reload
end
end
end