This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> p = Post.first | |
Post Load (0.1ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1 | |
=> #<Post:0x0000000378a408 | |
id: 1, | |
title: "Jhcuf gmodkt xmejrz axj koy fhv odfwzqva datc.", | |
body: | |
"Qsnmte hovxgzd yqsvg lipcd gcxzkoy lybr knwidyjr qhocjgum. Uzjge aps uvn qjgs ial vhwzjbam zioswu. Pkub qhplmktv ztxjca qtbik clz dcvr gbzodxmy. Wzbphko tvzgnpr eprmwbo. Wcn ajdlne utqxcvy fnc sqcljen hnkoyzm kpgbmvx. Jkh umzatdi zyqgwai vsj.", | |
created_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00, | |
updated_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00> | |
[2] pry(main)> p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects. | |
It will generate several classes such as: | |
.m-r-10 which gives margin-right 10 pixels. | |
.m-r-15 gives MARGIN to the RIGHT 15 pixels. | |
.m-t-15 gives MARGIN to the TOP 15 pixels and so on. | |
.p-b-5 gives PADDING to the BOTTOM of 5 pixels | |
.p-l-40 gives PADDING to the LEFT of 40 pixels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## The following was written to be run via the console. But can be easily modifed to fit within a service object that we can call to check and repair issues with duplicate positions. | |
## There may and probably will be a more effiency query, as I wrote this rather quickly. Feel to free to alter as you see fit. Just as long as it still serves its intended purpose. | |
# Returns the items that have a duplicate position | |
def items_with_duplicated_position(account) | |
@duped_positions = account.curriculums.select(:account_id, :position).group(:position, :account_id).having("COUNT(*) > 1").pluck(:position) | |
account.curriculums.where(position: @duped_positions) | |
end |