-
The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]
-
jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]
-
Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]
-
The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]
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
Benchmark.bmbm do |x| | |
x.report("each") do | |
count = 0 | |
self.posts.each do |p| | |
count += 1 if p.live? | |
end | |
count | |
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
source 'http://rubygems.org' | |
gem 'rails', '~> 3.0.4' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'sqlite3' | |
# Use unicorn as the web server |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
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
# This will help you trace .yml file which containts Psych::SyntaxError | |
require "rubygems" | |
require "psych" | |
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
# specify your locales folder in Dir.glob("*") with relative path from this file | |
Dir.glob("*").sort.each do |file| | |
begin |
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
%w(title menu_title).each do |column| | |
pages = pages.joins(:translations).select( | |
"#{translation_class.table_name}.#{column} as page_#{column}" | |
).where("#{translation_class.table_name}.#{column} IS NOT NULL") | |
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
if defined?(Bundler) | |
# If you precompile assets before deploying to production, use this line | |
# Bundler.require *Rails.groups(:assets => %w(development test)) | |
# If you want your assets lazily compiled in production, use this line | |
Bundler.require(:default, :assets, Rails.env) | |
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 self.search_filter(name,manufacture_id,product_type_id) | |
f_manufacture_id = manufacture_id | |
f_manufacture_id = f_manufacture_id.join(', ') unless manufacture_id.nil? | |
result = order("id DESC") | |
result = result.where("name LIKE ?", "%#{name}%") unless name.empty? | |
result = result.where("manufacture_id IN (?)", f_manufacture_id) unless manufacture_id.nil? | |
result = result.where(:product_type_id => product_type_id) unless product_type_id.blank? | |
result |
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
# Refinery CMS Core RSpec specs converted to MiniTest::Spec | |
# spec/minitest_helper.rb | |
require "minitest/spec" | |
require "minitest/autorun" | |
require "mocha" | |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path("../dummy/config/environment", __FILE__) |
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
Refinery::Core::Engine.routes.draw do | |
# frontend | |
namespace :blog do | |
root :to => "posts#index" | |
resources :posts | |
end | |
# backend | |
namespace :blog, :path => "" do |