siong1987 / mongoid_shortener Goto Github PK
View Code? Open in Web Editor NEWA Rails 3.1 engine based url shortener that has to used together with mongoid.
License: MIT License
A Rails 3.1 engine based url shortener that has to used together with mongoid.
License: MIT License
I am getting 2 errors:
when running MongoidShortener.generate("http://google.com")
Error returned:
ArgumentError: The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?
When running shortened_url("http://google.com")
Error Returned:
NoMethodError: undefined method `shortened_url' for main:Object
Rails 5.0.2
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
$ rails c
Loading development environment (Rails 4.1.8)
2.1.2 :001 > MongoidShortener.generate("http://google.com")
NoMethodError: undefined method attr_accessible' for MongoidShortener::ShortenedUrl:Class from /home/work/osp/mongoid_shortener/app/models/mongoid_shortener/shortened_url.rb:26:in
class:ShortenedUrl'
from /home/work/osp/mongoid_shortener/app/models/mongoid_shortener/shortened_url.rb:2:in <module:MongoidShortener>' from /home/work/osp/mongoid_shortener/app/models/mongoid_shortener/shortened_url.rb:1:in
<top (required)>'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:443:in load' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:443:in
block in load_file'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:633:in new_constants_in' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:442:in
load_file'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:342:in require_or_load' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:480:in
load_missing_constant'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:180:in const_missing' from /home/work/osp/mongoid_shortener/lib/mongoid_shortener.rb:10:in
generate'
from (irb):1
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in start' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in
start'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in console' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in
run_command!'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/railties-4.1.8/lib/rails/commands.rb:17:in <top (required)>' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in
require'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in block in require' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in
load_dependency'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in require' from /home/work/sntq/say_no_to_q/bin/rails:8:in
<top (required)>'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in load' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in
block in load'
from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in load_dependency' from /home/.rvm/gems/ruby-2.1.2@say_no_to_q/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in
load'
from /home/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' from /home/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
require'
MongoidShortener.generate("http://google.com")
ArgumentError: The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?
Hi @siong1987
I was pleased to discover this gem today when playing on the internet. I note that it is clearly derived from my own Shortener gem (https://github.com/jpmcgrath/shortener). I'm really pleased that you were able to put my code to good use, that's the whole point of sharing it.
I see that you have made some good improvements to the code, great stuff!
However, I would really appreciate it if you could replace my name in the copyright notice and mention that your gem is derived from my gem. This is considered polite behaviour in the open source community. Removing my name from the copyright notice in the license file is also specifically prohibited by the license. I don't mind you placing your own name in there as well, you deserve to as you have made significant modifications to your version, but my name should not have been removed.
Cheers,
James.
$ rails c
Loading development environment (Rails 4.1.8)
2.1.2 :001 > MongoidShortener.generate("http://google.com")
ArgumentError: The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?
from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validations/format.rb:39:in check_options_validity' from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validations/format.rb:20:in
check_validity!'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validator.rb:157:in initialize' from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validations/with.rb:89:in
new'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validations/with.rb:89:in block in validates_with' from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validations/with.rb:88:in
each'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activemodel-4.1.8/lib/active_model/validations/with.rb:88:in validates_with' from /home/.rvm/gems/ruby-2.1.2@app/gems/mongoid-4.0.0/lib/mongoid/validatable.rb:163:in
validates_with'
from /home/.rvm/gems/ruby-2.1.2@app/gems/mongoid-4.0.0/lib/mongoid/validatable/macros.rb:56:in validates_format_of' from /home/.rvm/gems/ruby-2.1.2@app/gems/mongoid_shortener-1.1.0/app/models/mongoid_shortener/shortened_url.rb:18:in
class:ShortenedUrl'
from /home/.rvm/gems/ruby-2.1.2@app/gems/mongoid_shortener-1.1.0/app/models/mongoid_shortener/shortened_url.rb:2:in <module:MongoidShortener>' from /home/.rvm/gems/ruby-2.1.2@app/gems/mongoid_shortener-1.1.0/app/models/mongoid_shortener/shortened_url.rb:1:in
<top (required)>'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:443:in load' from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:443:in
block in load_file'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:633:in new_constants_in' from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:442:in
load_file'
... 6 levels...
from /home/.rvm/gems/ruby-2.1.2@app/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in start' from /home/.rvm/gems/ruby-2.1.2@app/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in
console'
from /home/.rvm/gems/ruby-2.1.2@app/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in run_command!' from /home/.rvm/gems/ruby-2.1.2@app/gems/railties-4.1.8/lib/rails/commands.rb:17:in
<top (required)>'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in require' from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in
block in require'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in load_dependency' from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in
require'
from /home/work/sntq/say_no_to_q/bin/rails:8:in <top (required)>' from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in
load'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in block in load' from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in
load_dependency'
from /home/.rvm/gems/ruby-2.1.2@app/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in load' from /home/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
require'
from /home/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.