harika396 / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

[filen] replacement for content_nodes doesn't work #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new content, for example a snippet
2. Attach an image file
3. Try to reference the image file from within the snippet using [file1]

What is the expected output? What do you see instead?

[file1] should be replaced with the path to the newly uploaded image.

What version of the product are you using? On what operating system?

1.0 I think. Linux.

Please provide any additional information below.

The fix is as follows:

@content_node.content.gsub!("[file#{files_saved}]", new_file.public_filename)

should be

@content_node.content = @content_node.content.gsub("[file#{files_saved}]",
new_file.public_filename)

It appears that rails doesn't notice that the content attribute is dirty
and needs persisting if you use the ! in place gsub.

//matt

Original issue reported on code.google.com by matt.g...@gmail.com on 26 Nov 2008 at 12:35

GoogleCodeExporter commented 9 years ago
Fixed r174

Thanks for the patch. I've applied it, but please next time include a proper 
patch
(with tests) as outlined here:

http://code.google.com/p/substruct/wiki/ContributingToSubstruct

All tests should pass when you run "rake test:plugins:all PLUGIN=substruct"

It takes longer for me to apply these things if I have to write test code and 
verify
myself that things work as they should.

Original comment by subim...@gmail.com on 25 Jan 2009 at 8:11