This file contains hidden or 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
# a.rb | |
require_relative 'a/b' | |
module A | |
end |
This file contains hidden or 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
def rhost(www = nil) | |
if request.host != "www#{env_dev}.a.a" | |
request.host.gsub(/^w+(|\d+)\./, "").gsub(/\.a\.a/, "") | |
elsif www == 1 && request.host == "www#{env_dev}.a.a" | |
'www' | |
elsif www == 2 | |
'test' | |
else | |
nil | |
end |
This file contains hidden or 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
require 'rails_helper' | |
require 'pry' | |
RSpec.describe UsersController, type: :controller do | |
let(:climber) { User.create!(email: '[email protected]', password: '123456', first_name: 'test', last_name: 'test', | |
user_name: 'climber') } | |
let(:setter) { User.create!(email: '[email protected]', password: '123456', first_name: 'test', last_name: 'test', | |
user_name: 'setter', route_setter: true) } | |
let(:owner) { User.create!(email: '[email protected]', password: '123456', first_name: 'test', last_name: 'test', | |
user_name: 'owner', gym_owner: true) } |
This file contains hidden or 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
%li | |
= link_to "Remove from collection", remove_from_collection_posts_path(cid: params[:id], pid: post.id), data: { confirm: "Are you sure you want to remove this post?" }, remote: true |
This file contains hidden or 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
class BooksController < ApplicationController | |
def index | |
@books = Book.all | |
end | |
def search | |
@books = Book.all | |
if params[:price].present? | |
@books = @books.where('price <= ?', params[:price]) |
This file contains hidden or 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
class AddPriceToLineItem < ActiveRecord::Migration[5.0] | |
def change | |
add_column :line_items, :price, :decimal | |
LineItem.includes(:product).find_each do |li| | |
li.update(price: li.product.price) | |
end | |
end | |
end |
This file contains hidden or 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
class CreateReleaseSteps < ActiveRecord::Migration[5.0] | |
def change | |
create_table :release_steps do |t| | |
t.belongs_to :release, index: true | |
t.string :name | |
t.string :loadbalancer | |
t.string :comment | |
t.integer :release_id | |
end | |
end |
This file contains hidden or 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
validate :relation_with_same_tenant | |
....... | |
private | |
def relation_with_same_tenant | |
if self.shop_id!=ui_listable.shop_id | |
self.errors.add(:ui_listable,"ERROR MESSAGE") |
This file contains hidden or 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
Started PATCH "/users/28/edit" for 192.168.0.100 at 2016-09-23 22:40:26 +0200 | |
Processing by UsersController#edit as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"BILLq+y8oXYL6aECCZCPONCAalsaKMYfZWFB50J3kNRQCSdt1Fy+X17fExIXML0bi5p00mH07lXXJNKOecytjA==", "user"=>{"name"=>"Name Update", "email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "button"=>"", "id"=>"28"} | |
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 28], ["LIMIT", 1]] | |
Rendering users/edit.html.erb within layouts/application | |
Rendered shared/_errors.html.erb (0.4ms) | |
Rendered users/edit.html.erb within layouts/application (3.6ms) | |
Rendered application/_favicon.html.erb (8.4ms) | |
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 28], ["LIMIT", 1]] | |
Rendered layouts/_header.html.erb (3.6ms) |
This file contains hidden or 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
class ApplicationController < ActionController::Base | |
... | |
... | |
include DeviseCustomParams | |
end |
NewerOlder