Skip to content

Commit

Permalink
some fix to work better with ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopheBelpaire committed Mar 14, 2012
1 parent e59ea75 commit 53abd03
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion lib/prawnto/template_handlers/partials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ def get_file_path(partial_name)
end

def cleaned_path(provided_partial_path)
*provided_path, file_name = provided_partial_path.split("/")
if (RUBY_VERSION > "1.8.7")
eval('*provided_path, file_name = provided_partial_path.split("/")')
else
splitted_provided_partial_path = provided_partial_path.split("/")
provided_path = splitted_provided_partial_path[0..-2]
file_name = splitted_provided_partial_path.last
end

file_name = "_"+file_name unless file_name[0] == "_"
File.join(provided_path, file_name)
end
Expand Down
8 changes: 4 additions & 4 deletions spec/dummy/app/mailers/pdf_emailer.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class PdfEmailer < ActionMailer::Base
helper :application
default from: "from@example.com"
default :from => "from@example.com"

def email_with_attachment
@x = 1

attachments["hello_world.pdf"] = render("test/default_render", :format => :pdf)
mail :subject => "Hello", :to => "test@test.com" do |format|
format.text
end
end

end
2 changes: 1 addition & 1 deletion spec/dummy/config/initializers/session_store.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.

Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
wrap_parameters :format => [:json]
end

# Disable root element in JSON by default.
Expand Down

2 comments on commit 53abd03

@forrest
Copy link

Choose a reason for hiding this comment

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

Nice cleanup. Mind if I pull it?

@ChristopheBelpaire
Copy link
Owner Author

Choose a reason for hiding this comment

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

No problem, but it doesn't solve all 1.8.7 issues :s
Tests do not all pass on 1.8.7.

Please sign in to comment.