Hi Dimitar,

The model generator doesn't check everything. It seems that you have
inserted a couple of errors in the Percentile model:

- You have used "test" as one of the column names, which seems to be a
reserved word.
- There is no "number" field type. You should use something like integer
or decimal.

This is your line corrected:

hobo generate resource percentile sex:string age_group:string
age_from:integer age_to:integer diab_status:string test_id:integer
test_text:string percentile:integer value:integer

Regards,
Ignacio

El 03/08/13 08:17, Dimitar Hristovski escribió:
> I will be very happy for any help in resolving the following situation.
> 
> In a fresh hobo application, I did:
> hobo generate resource percentile sex:string age_group:string
> age_from:integer age_to:integer diab_status:string test_id:integer
> test:string percentile:integer value:number
> 
> The command did something without complaining, but I do not have the
> exact command response (is this logged somewhere?)
> 
> After the above hobo generate resource command, whatever I do (like
> rails server, hobo generate migration, hobo destroy resource, ...), I
> always get this:
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo_support-2.0.1/lib/hobo_support/string.rb:23:in
> `class_eval': can't convert Symbol into Integer (TypeError)
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/app/models/percentile.rb:12:in
> `block in <class:Percentile>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo_fields-2.0.1/lib/hobo_fields/extensions/active_record/fields_declaration.rb:15:in
> `instance_eval'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo_fields-2.0.1/lib/hobo_fields/extensions/active_record/fields_declaration.rb:15:in
> `fields'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/app/models/percentile.rb:5:in
> `<class:Percentile>'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/app/models/percentile.rb:1:in
> `<top (required)>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:469:in
> `load'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:469:in
> `block in load_file'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:639:in
> `new_constants_in'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:468:in
> `load_file'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:353:in
> `require_or_load'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:502:in
> `load_missing_constant'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:192:in
> `block in const_missing'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:190:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:190:in
> `const_missing'
>         from (eval):1:in `safe_constantize'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo_support-2.0.1/lib/hobo_support/string.rb:23:in
> `class_eval'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo_support-2.0.1/lib/hobo_support/string.rb:23:in
> `safe_constantize'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/action_controller/metal/params_wrapper.rb:152:in
> `_default_wrap_model'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/action_controller/metal/params_wrapper.rb:169:in
> `_set_wrapper_defaults'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/action_controller/metal/params_wrapper.rb:133:in
> `inherited'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/abstract_controller/railties/routes_helpers.rb:7:in
> `block (2 levels) in with'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/action_controller/railties/paths.rb:7:in
> `block (2 levels) in with'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/app/controllers/percentiles_controller.rb:1:in
> `<top (required)>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:469:in
> `load'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:469:in
> `block in load_file'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:639:in
> `new_constants_in'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:468:in
> `load_file'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:353:in
> `require_or_load'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:502:in
> `load_missing_constant'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:192:in
> `block in const_missing'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:190:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:190:in
> `const_missing'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:230:in
> `block in constantize'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:229:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:229:in
> `constantize'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/core_ext/string/inflections.rb:54:in
> `constantize'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/hobo/controller/model.rb:69:in
> `block (2 levels) in all_controllers'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/hobo/controller/model.rb:65:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/hobo/controller/model.rb:65:in
> `block in all_controllers'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/hobo/controller/model.rb:62:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/hobo/controller/model.rb:62:in
> `all_controllers'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/generators/hobo/routes/routes_generator.rb:32:in
> `controllers_for'
>         from (erb):11:in `block in template'
>         from (erb):6:in `each'
>         from (erb):6:in `template'
>         from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/erb.rb:838:in `eval'
>         from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/erb.rb:838:in
> `result'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/file_manipulation.rb:117:in
> `block in template'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/create_file.rb:54:in
> `call'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/create_file.rb:54:in
> `render'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/create_file.rb:47:in
> `identical?'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/create_file.rb:73:in
> `on_conflict_behavior'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:114:in
> `invoke_with_conflict_check'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/create_file.rb:61:in
> `invoke!'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions.rb:95:in
> `action'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/create_file.rb:26:in
> `create_file'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions/file_manipulation.rb:116:in
> `template'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/generators/hobo/routes/routes_generator.rb:21:in
> `generate_routes'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in
> `run'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in
> `invoke_command'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
> `block in invoke_all'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
> `map'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
> `invoke_all'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/group.rb:233:in
> `dispatch'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in
> `start'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/generators.rb:171:in
> `invoke'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/hobo-2.0.1/lib/hobo/engine.rb:69:in
> `block (2 levels) in <class:Engine>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:429:in
> `_run__691314256__prepare__831797338__callbacks'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in
> `__run_callback'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in
> `_run_prepare_callbacks'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in
> `run_callbacks'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:74:in
> `prepare!'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:48:in
> `prepare!'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/application/finisher.rb:47:in
> `block in <module:Finisher>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:30:in
> `instance_exec'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:30:in
> `run'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:55:in
> `block in run_initializers'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:54:in
> `each'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:54:in
> `run_initializers'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/application.rb:136:in
> `initialize!'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:in
> `method_missing'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/config/environment.rb:5:in
> `<top (required)>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in
> `require'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in
> `block in require'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in
> `load_dependency'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in
> `require'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/config.ru:3:in
> `block in <main>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
> `instance_eval'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
> `initialize'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/config.ru:in `new'
>         from
> C:/Users/mitko/Prjs/Levett/Predictor/hobo/predictor/config.ru:in `<main>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in
> `eval'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in
> `parse_file'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in
> `app'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/commands/server.rb:46:in
> `app'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in
> `wrapped_app'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in
> `start'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/commands/server.rb:70:in
> `start'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:55:in
> `block in <top (required)>'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:50:in
> `tap'
>         from
> C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:50:in
> `<top (required)>'
>         from script/rails:6:in `require'
>         from script/rails:6:in `<main>'
> --------------------------------------------------------------------
> Probably :number is not allowed in the hobo generate resource, but it
> did not complain. When I tried hobo destroy resource to first destroy
> the resource and then try again, I am getting the string of messages
> shown above.
> 
> Please let me know what I should do to resolve the situation.
> 
> Thanks,
> Dimitar
> 
> P.S. This is the percentile.rb file:
> class Percentile < ActiveRecord::Base
> 
>   hobo_model # Don't put anything above this
> 
>   fields do
>     sex         :string
>     age_group   :string
>     age_from    :integer
>     age_to      :integer
>     diab_status :string
>     test_id     :integer
>     test        :string
>     percentile  :integer
>     value       :number
>     timestamps
>   end
>   attr_accessible :sex, :age_group, :age_from, :age_to, :diab_status,
> :test_id, :test, :percentile, :value
> 
>   # --- Permissions --- #
> 
>   def create_permitted?
>     acting_user.administrator?
>   end
> 
>   def update_permitted?
>     acting_user.administrator?
>   end
> 
>   def destroy_permitted?
>     acting_user.administrator?
>   end
> 
>   def view_permitted?(field)
>     true
>   end
> 
> end
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to