class DealsController < ApplicationController
before_filter :authenticate_user!, except: [:index, :show, :list]
before_filter :authenticate_proposer, only: [:edit]
rescue_from StandardError, with: :show_errors
rescue_from Order::OrderNotFound, with: :show_errors
##Ruby (Rails) tips
####1. Array Initialization
if x.is_a?(Array)
x.each { |x| puts x }
else
puts x
end
- Star Rating with only CSS
<div class="star-wrapper">
<a class="star" href="javascript:alert(1)"></a>
<div class="star-wrapper">
<a class="star"></a>
<div class="star-wrapper">
<a class="star"></a>
<div class="star-wrapper">
Setup a WYSIWYG editor with CKEditor. Includes instruction for Rails_Admin
- Add
gem 'ckeditor'
to your Gemfile and bundle - Checkout https://github.com/galetahub/ckeditor for instruction to generate the correct model to generate for uploading of files (eg. ActiveRecord + Paperclip)
- Run
rake db:migrate
- Add
//= require ckeditor/override
in your application.js (before require_tree .)
To configure the editor to be used in Rails_Admin, follow this https://github.com/sferik/rails_admin/wiki/CKEditor
= simple_form_for @time_slot, url: booking_path, method: :patch do |f|
= f.input :start_time, :as => :datetime, :minute_step => 30, :include_seconds => true, :discard_year => true, :datetime_separator => ' — ', :time_separator => ' - '
= f.input :id, as: :hidden
= f.submit "Book this slot", class: 'btn'
OlderNewer