innku / innsights-gem Goto Github PK
View Code? Open in Web Editor NEWInnsights Gem
License: MIT License
Innsights Gem
License: MIT License
The problem comes when calling Config#valid?. Since a model does respond to #create Config#valid? returns true, but create expects a Hash and receives a block in the #commit method.
Something akin to this happens:
irb(main):005:0> User.create ->{}
NoMethodError: undefined method `stringify_keys' for #<Proc:0x0000000572eae8@(irb):5 (lambda)>
I propose this for Config#valid? method:
def valid?
ActiveRecord::Callbacks::CALLBACKS.include? event.to_sym
end
/home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/attribute_assignment.rb:69:in assign_attributes': undefined method
stringify_keys' for #Proc:0x0000000211ed90 (NoMethodError)
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/base.rb:498:in initialize' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/persistence.rb:44:in
new'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/persistence.rb:44:in create' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/innsights-gem-bc7976446eea/lib/innsights/config/model.rb:30:in
commit'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/innsights-gem-bc7976446eea/lib/innsights.rb:236:in watch' from /home/maca/Web/gazelles/config/initializers/innsights.rb:9:in
block in <top (required)>'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/innsights-gem-bc7976446eea/lib/innsights.rb:164:in instance_eval' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/innsights-gem-bc7976446eea/lib/innsights.rb:164:in
setup'
from /home/maca/Web/gazelles/config/initializers/innsights.rb:3:in <top (required)>' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in
load'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in block in load' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in
load_dependency'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in load' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:588:in
block (2 levels) in class:Engine'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:587:in each' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:587:in
block in class:Engine'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in instance_exec' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in
run'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in block in run_initializers' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in
each'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in run_initializers' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in
initialize!'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in method_missing' from /home/maca/Web/gazelles/config/environment.rb:5:in
<top (required)>'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in require' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in
block in require'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in load_dependency' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in
require'
from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:103:in require_environment!' from /home/maca/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:40:in
<top (required)>'
from script/rails:6:in require' from script/rails:6:in
New hash syntax {key: value} breaks apps running in ruby 1.8.7
@@enable_hash is one example but should look for it in the entire project.
In the Report controller your using safe constantize method. The thing is safe_constantize was introduced in Rails 3.2.(http://apidock.com/rails/v3.2.8/ActiveSupport/Inflector/safe_constantize)
The error was /home/rutanet/.rvm/gems/ruby-1.9.3-p194/bundler/gems/innsights-gem-95895ebe5b6f/lib/innsights/config/reports/controller_report.rb:52:in controller_class': undefined method
safe_constantize' for "RecipesController":String (NoMethodError)
We created a controller action like the following
on "recipes#index" do
report "Something"
user :current_user
end
When configuring a callback with the DSL:
watch Model do
report "Action"
upon :update
end
The default timestamp is the created at of the record which is confusing,
Options:
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.