Hi all,
How to avoid class name conflict in model class and gem class name if both
same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where I
have used model country. And gives model query error.
Hi all,
How to avoid class name conflict in model class and gem class name if both same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where I have used model country. And gives model query error.
Hi all,
How to avoid class name conflict in model class and gem class name if both
same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where I
have used model country. And gives model query error.
Is it not the case that you CAN enforce the use of the correct class by using explicit naming i.e. "namespace::classname"?
That, at least, is my understanding of the documentation. Are there cases where this approach will not work?
···
On 24/11/2015 2:26 AM, Indrajeet Mishra wrote:
Hi all,
How to avoid class name conflict in model class and gem class name if both same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where I have used model country. And gives model query error.
No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2015.0.6176 / Virus Database: 4460/11058 - Release Date: 11/24/15
I have used another gem to resolved the problem, my question is how we can resolve if there is no alternatives.
On Nov 24, 2015 8:00 AM, "thomas Perkins" <thomas.perkins23@icloud.com> wrote:
Change the name of your class to something that resembles country, something like area, or state
Hi all,
How to avoid class name conflict in model class and gem class name if both same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where I have used model country. And gives model query error.
Hi all,
How to avoid class name conflict in model class and gem class name if both same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where I have used model country. And gives model query error.
I have used another gem to resolved the problem, my question is how we can
resolve if there is no alternatives.
On Nov 24, 2015 8:00 AM, "thomas Perkins" <thomas.perkins23@icloud.com> > wrote:
Change the name of your class to something that resembles country,
something like area, or state
Hi all,
How to avoid class name conflict in model class and gem class name if
both same??
Example:1) Model class Country
2) gem countries have Country class
When application runs it always take gems countries class Country, where
I have used model country. And gives model query error.
Sometimes you can do this, but it can be difficult in a Rails app, since Rails brings expectations about a correspondence between directory/file names and class names.
Is it not the case that you CAN enforce the use of the correct class by using explicit
naming i.e. "namespace::classname"?
That, at least, is my understanding of the documentation. Are there cases where this approach will not work?
Thanks for that Bryce - I'm NOT fluent in Rails! That will teach me to read the question!
···
On 25/11/2015 1:57 AM, Bryce Kerley wrote:
On 24 Nov 2015, at 16:31, Patrick Bayford wrote:
Is it not the case that you CAN enforce the use of the correct
class by using explicit
naming i.e. "namespace::classname"?
That, at least, is my understanding of the documentation. Are
there cases where this approach will not work?
Sometimes you can do this, but it can be difficult in a Rails app, since Rails brings expectations about a correspondence between directory/file names and class names.
Always personalize your classes and methods to be unique. Always. Security is very very good. Use that even in the placement of where you question if it is needed.
Rule: Never even approach using names that are so obvious.