Every repository with this icon (
Every repository with this icon (
| Description: | Some [hopefully] useful extensions to Ruby’s String class. It is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to Ascii transliteration], and StringExtensions [miscellaneous helper methods for the String class]. edit |
-
before_validation_on_create removed in Rails 3
1 comment Created 3 months ago by dbackeusIn the current edge rails it seems before_validation_on_create is deprecated in favor of
before_validation :asdf, :on => :createActs as url would need to be patched to conform to this.
Comments
-
Here is the backtrace when I require 'stringex' with Ruby 1.9.1.
Did you plan Ruby 1.9.1 support ? As strings are handled differently, I suppose that it's a big work.irb(main):001:0> require 'stringex' SyntaxError: /opt/local/lib/ruby/gems/1.9.1/gems/rsl-stringex-1.0.0/lib/lucky_sneaks/string_extensions.rb:123: invalid multibyte char (US-ASCII) /opt/local/lib/ruby/gems/1.9.1/gems/rsl-stringex-1.0.0/lib/lucky_sneaks/string_extensions.rb:123: invalid multibyte char (US-ASCII) /opt/local/lib/ruby/gems/1.9.1/gems/rsl-stringex-1.0.0/lib/lucky_sneaks/string_extensions.rb:123: syntax error, unexpected $end, expecting tASSOC /(\s|^)£(\d+)\.(\d+)(\s|$)/u => '\2 pounds \3 pence', ^ from /opt/local/lib/ruby/gems/1.9.1/gems/rsl-stringex-1.0.0/lib/stringex.rb:1:in `require' from /opt/local/lib/ruby/gems/1.9.1/gems/rsl-stringex-1.0.0/lib/stringex.rb:1:in `' from (irb):1:in `require' from (irb):1 from /opt/local/bin/irb:12:in `'Comments
Yeah. I've got some ppl clamoring for it an even a commit in there but I imagine there's a good bit I'm going to have to do to get it working and I really don't have the free time at this moment. It's definitely on my list though.
Hey, I bumped the version number. Hoodow's commit should have fixed this. Can you lemme know if your version contained the # coding line at the top of string_extensions.rb? Thanks. Hopefully we will get this ironed out soon.
I've just tried 1.0.2, and I see similar results with +to_ascii+ in Ruby 1.8.6 and Ruby 1.9.1.
Thanks a lot !I see the same results with text from China, Japan, an Russian. So I suppose I can close the ticket. Thanks again.
-
I have not been able to come up with a 100% reproducible test case, but I have noticed several occasions now where a record is created and somehow stringex/acts_as_url creates a nil url.
even with auto sync set, updating the url attribute for this record does not cause the url to be re-generated.
it may have to do with plurals or creating a record whose url attribute contains a subset of the same url as an existing record like:
"Happy Farm" "Happy Farms"Will try some more extensive testing at some point in the near future.
Comments
Was this related to the stuff we discussed on IRC? Github just saying "about" a month ago which lines up close to when we added that patch.
only sort of. the stuff we discussed on IRC was related to the patch I submitted which had to do with un-necessarily changing the URL if auto_sync was set.
this has to do with urls simply not being generated at all. i'll try to generate some kind of test today.
well technically the patch came from someone else, and then i wrote tests.
Lemme know. [I'm on IRC today as well]. Workload today might be lighter so mebbe time for housekeeping on Stringex!
jeffrafter
Sun Oct 11 15:23:21 -0700 2009
| link
Can this issue be closed?
-
I propose that the duplicate urls be distinguished with two dashes instead of one. I think that it provides a better semantic.
ex: /peugeot-206--2/ instead of /peugeot-206-2/
This, I think, means that the line 82 of acts_as_url.rb should be "#{base_url}--#{n}".
Comments
I like the idea but wonder if someone won't turn around and ask for three dashes because two dashes has specific meaning to them. Thoughts?
I've provided an example of one dash being an issue. I can't think of any example where two dashes would be an issue. Until someone comes up with an example, it seems that the two dashes solution is the best.
It's not my idea actually, I saw it applied on another plugin. It looked great to me, so I decided to submit it to you, so that you have this fine little complement put in :)
I would prefer to add an option to choose a custom separator which defaults to one single dash.
-
If i set the url to nil to clear the url and save the Page it dosen't regenerate the url.
Model:
acts_as_url :title, :only_when_blank => true
console: http://pastie.org/537638Comments
i am noticing a similar problem. some records were created, but, from the outset, stringex didn't generate a url for the acts_as_url field. i think it has something to do with the name of the record, but I can't figure out how/why.
Just now seeing these tickets here. Can you please provide a failing test for this? Lemme know if you cannot.
jeffrafter
Sun Oct 11 15:23:46 -0700 2009
| link
Can this issue be closed?
think so. i recall providing rsl with the stuff he needed and it got fixed that day. check the changelogs?
jeffrafter
Sun Oct 11 15:30:44 -0700 2009
| link
Yeah I thought this was related to the other error in #3 -- both of which I think were resolved in 1.0.2 I believe (http://github.com/rsl/stringex/commit/63cf46ddeb6fe5d123e48528f493f8ae48132d97, and the next three commits)












fixed in 60cc6221