-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
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
Leave Scope Added #271
Leave Scope Added #271
Conversation
Leave scope added and now the function can be used as ModelName.leaves
Leave option added - dependent function added |
@ImDineshSaini this PR is a total rip off of #246 |
Yes and one more changes required I have seen the Rails 4 is work with mysql2 gem so text_type = if ActiveRecord::Base.connection.adapter_name.downcase == 'mysql2' replaced by text_type = if ActiveRecord::Base.connection.adapter_name.downcase == 'mysql' |
this PR is a total rip off of #246 is improved as Gem thrown error if utf8 is not selected during casting and need mysql2 as connection name for rails 4
this PR is a total rip off of #246 + Fix the mysql connection error with rails 4 and utf issue. |
@ImDineshSaini all of that is fixed in #246 and tested |
I have tries with Rails 4.2.3 and mysql and it give me error and reason is that mysql2 is use as connection not mysql. |
id_column_as_text = sql_cast_as_text(id_column) | ||
parent_ancestry = sql_concat("#{table_name}.#{ancestry_column}", "'/'", id_column_as_text) | ||
|
||
joins("LEFT JOIN #{table_name} AS c ON c.#{ancestry_column} = #{id_column_as_text} OR c.#{ancestry_column} = #{parent_ancestry}"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to use an existing scope here?
Only adding the group
and having
Also, should id
be primary_key
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better yet, is there a way to extract this concept so we can use it more?
'TEXT' | ||
end | ||
# updated mysql thrown error if utf is not defined | ||
"CAST(#{column} AS #{text_type}) collate utf8_unicode_ci" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think the collate
is better up with mysql only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please be nice
Closing in favor of #246 |
Leave scope added and now the function can be used as ModelName.leaves