Giter Club home page Giter Club logo

innsights-gem's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

innsights-gem's Issues

Providing the wrong callback i.e. :create instead of :after_create for report action raises an error instead of logging the warning

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 methodstringify_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:innew'
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:incommit'
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:inblock 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:insetup'
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:inload'
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:inload_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:inblock (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:inblock 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:inrun'
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:ineach'
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:ininitialize!'
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:inblock 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:inrequire'
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

'

Controller reports aren't working in Rails 3.1

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 methodsafe_constantize' for "RecipesController":String (NoMethodError)

We created a controller action like the following

on "recipes#index" do
report "Something"
user :current_user
end

Improper defaults for updated and destroy callbacks

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:

  • There should be no defaults for those events and the timestamp should be a mandatory part of the DSL
  • The default should be Time.now instead of Model#created_at

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.