if you do not have asset server, can not pay to upyun, and s3 also. you can assign this work to system link, then you will get good job. put the link upder every project's public directory
This file contains 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
after "deploy:restart", "resque:stop_workers" | |
namespace :resque do | |
task :stop_workers, :except => { :no_release => true } do | |
run "cd #{current_path} && rake RAILS_ENV=#{rails_env} resque:stop_workers" | |
end | |
end |
This file contains 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 User < ActiveRecord::Base | |
establish_connection "users_#{Rails.env}" # use alternate DB | |
has_many :memberships | |
has_many :groups, through => :memberships | |
end | |
class Group < ActiveRecord::Base | |
establish_connection "users_#{Rails.env}" # use alternate DB | |
has_many :memberships | |
has_many :users, :through => :memberships |
This file contains 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 Recommend::RecommendProduct | |
include Mongoid::Document | |
field :position, type: String | |
field :name, type: String | |
field :image, type: String | |
field :title, type: String | |
field :price, type: Float | |
field :cnt_buy, type: Integer | |
field :cnt_comment, type: Integer |
This file contains 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
# encoding: utf-8 | |
class Recommend::RecommendUser | |
include Mongoid::Document | |
field :position, type: String | |
field :name, type: String | |
field :body, type: String | |
field :created_at, type: DateTime | |
field :updated_at, type: DateTime | |
#field :users, type: Array |
This file contains 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 Assignment < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :cms_role | |
end |
This file contains 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
<%- model_class = @auth_user.class -%> | |
<div class="page-header"> | |
<h1><%=t '.title', :default => t('helpers.titles.new', :model => model_class.model_name.human, | |
:default => "New #{model_class.model_name.human}") %></h1> | |
</div> | |
<%= simple_form_for([:auth,@auth_user]) do |f| %> | |
<%= f.error_notification %> | |
<div class="form-inputs"> | |
<%= f.input :username %> |
This file contains 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
<%= form_tag(common_search_url,:class=>"navbar-search") do %> | |
<%= text_field_tag(:q,params[:q] || I18n.t("menu.search"), :class => "search-query") %> | |
<!--%- @model_class = params[:controller].capitalize.singularize if params[:controller].capitalize.singularize.class_exists? -%--> | |
<%- @type_choose = params[:type] if (params.has_key? :type) and params[:type].present? -%> | |
<%- @model_class = params[:controller].classify.constantize if params[:controller].classify.class_exists? -%> | |
<%- @model_class = params[:controller].gsub(/\w+([@\s\/]+)/,"").classify.constantize if params[:controller].gsub(/\w+([@\s\/]+)/,"").classify.class_exists? -%> | |
<% unless @model_class.nil? %> | |
<%= hidden_field_tag 'model', @model_class.to_s %> | |
<% if (@model_class.method_defined? :columns) or (@model_class.respond_to? :columns) %> | |
<!--%= select_tag "type", options_from_collection_for_select(@model_class.columns, "name", "name")%--> |
Cleanup then broken commands:
$ rm -rf ~/.bundle/ ~/.gem/
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control