Skip to content

Instantly share code, notes, and snippets.

View salami-art's full-sized avatar

salami-art

View GitHub Profile
module Rateable
def self.included(base)
base.class_eval do
attribute :average_rating
attribute :ratings_total
has_many :all_ratings, foreign_key: "#{self.class.name}_id", class_name: 'Rating' # class_name should be the included class name but returns 'Class'instead
has_many :published_ratings, -> { where(:status => Rating::STATUSES[:PUBLISHED])}, foreign_key: "#{self.class.name}_id", class_name: "Rating"
end
end
end
declare var $: any;
declare var application: Application;
class ApplicationModule {
}
class modalHandling extends ApplicationModule {
public get(action: string) {
application.html.get(`/modals/${ action }`, function(data: string) {
let container = this.getContainer();
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'devise'
# Add additional requires below this line. Rails is not loaded until this point!
require 'rails_helper'
RSpec.describe RegistrationController do
include Devise::Test::ControllerHelpers
describe 'POST /users for user' do
let(:user) {
{
email: "[email protected]",
password: "master-tester",
upstream puma {
server unix:///home/ubuntu/apps/MyApp/shared/tmp/sockets/MyApp-puma.sock;
}
server {
listen 80 default_server deferred;
if ($http_user_agent ~* (banned|banned1|banned2)) {
return 403;
}
<article>
<h1>An article about lemons</h1>
<img alt="a picture of lemons">
<h3>What are lemons?</h3>
<p>Lemons are a yellow fruit [ .... ] </p>
<h3>Where do lemons grow?</h3>
<p>Lemons grow on lemon trees [ .... ] </p>
<img alt="a green lemon">
<h3>Who eats lemons?</h3>
<p>Kids love lemons! [ .... ] </p>
/* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
function importAll (r) {
r.keys().forEach(r);
def contents_listing_block_for(object_list, title, &block)
tag.div :class => 'card' do
capture do
concat tag.header :class => 'card__header' do
concat title
end
concat tag.section :class => 'card__body' do
concat tag.ul :class => 'listing' do
<%#= render :partial => 'health_facilities/partials/breadcrumb' %>
<% if !params[:region].present? && !params[:province].present? && params[:speciality_title].present? %>
<!-- SPECIALTY, NO PROVINCE NO REGION -->
<h2>Strutture - <%= @speciality.title %></h2>
<div class="description">
<div class="hidden">
In queste pagine puoi trovare interessanti contenuti su tanti argomenti. <br />
Naviga per categoria, in ordine alfabetico o per specialità, oppure utilizza il campo di ricerca per cercare esclusivamente fra i contenuti.<br />Registrati o effettua il login per poter salvare i contenuti preferiti e ricevere suggerimenti su misura per te.
In queste pagine puoi trovare tante strutture sanitarie per le diverse aree di specializzazione. <br />
<% content_for :footer_scripts do %>
<script type="text/javascript">
<% if @current_province.present? %>
$('#provinces').val('<%= @current_province.name.titleize %>');
<% end %>
<% if @current_speciality.present? %>
$('#specialities').val('<%= @current_speciality.profession.capitalize %>');
<% end %>
</script>
<% cache 'docdropdown_data' do %>