We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, I get the error 'No such file or directory @ rb_sysopen - path/app/models/underscored_model_name.rb'
'No such file or directory @ rb_sysopen - path/app/models/underscored_model_name.rb'
This is because of https://github.com/palkan/logidze/blob/master/lib/generators/logidze/model/model_generator.rb#L91
I propose that instead, 'UnderscoredModelName'.constantize should be used, so the file path can be retrieved via:
'UnderscoredModelName'.constantize
[20] pry(main)> ap name = 'StepDefinitions::Base'; klass = name.constantize; (klass.methods - ActiveRecord::Base.methods).select{ |meth| location_path = klass.method(meth).source_location[0]; location_path.include?('/app/') && location_path.ends_with?("#{name.underscore}.rb") }.map{ |meth| [ meth, klass.method(meth).source_location ] } => [ [ :excluding_type, [ "/project_path/app/models/data/step_definitions/base.rb", 149 ] ], [ :types, [ "/project_path/app/models/data/step_definitions/base.rb", 145 ] ] ]
The text was updated successfully, but these errors were encountered:
Unfortunately, this method won't work if your model doesn't have any own methods.
I think, it's better to provide an option to set the file path explicitly, e.g.:
rails g logidze:model "StepDefinitions::Base" --path "app/models/data/step_definitions/base.rb"
Sorry, something went wrong.
that's true. A path option would def solve the problem
Done. Checkout version 0.4.1
No branches or pull requests
Currently, I get the error
'No such file or directory @ rb_sysopen - path/app/models/underscored_model_name.rb'
This is because of https://github.com/palkan/logidze/blob/master/lib/generators/logidze/model/model_generator.rb#L91
I propose that instead,
'UnderscoredModelName'.constantize
should be used, so the file path can be retrieved via:The text was updated successfully, but these errors were encountered: