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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- ... --> | |
</head> | |
<body> | |
<%= if current_user.signed_in? %> | |
<%= if current_page?(booking_rides_path) %> | |
<% 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 ExampleFormBuilder < ActionView::Helpers::FormBuilder | |
def error(method, error_text = nil, options = {}) | |
return if errors_blank?(method) && error_text.blank? | |
text = if error_text | |
error_text | |
elsif object.errors.custom_messages_for(method) | |
object.errors.custom_messages_for(method).to_sentence | |
else | |
object.errors.full_messages_for(method).to_sentence |
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
# UNEXPECTED BEHAVIOUR | |
class User < ApplicationRecord | |
has_many :client_posts, | |
class_name: Client::Post.name, | |
foreign_key: :user_id | |
end | |
class Client::Post < ApplicationRecord | |
# Note how the class_name is declared here |
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 OrdersController < ApplicationController | |
def new | |
# some cool code | |
end | |
def create | |
# some cool code | |
end | |