class PeopleController < ApplicationController
def create
Person.create(person_params)
end
private
def person_params
params.require(:person).permit(:name, :age)
end
end
scope :with_images {:joins => [:images], :conditions => "images.project_id IS NOT NULL"}
def self.with_images
all.reject{|t| t.images.empty?}
end
You'll sometimes have groups of gems that only make sense in particular environments. For instance, you might develop your app (at an early stage) using SQLite, but deploy it using mysql2 or pg. In this example, you might not have MySQL or Postgres installed on your development machine, and want bundler to skip it.
Иногда у Вас может возникнуть необходимость использовать разные наборы гемов в разных окружениях. К примеру: вы разрабатываете приложение, используя SQLite, но при этом на сервере используете Postgres. В таком случае, Вам не нужно, чтобы Postgres устанавливался на локальной машине.