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
| extra_attributes.each do |name, value| | |
| case name.to_sym | |
| when :fullname | |
| self.fullname = value | |
| when :email | |
| self.email = value | |
| end | |
| 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
| # Not easy to parse and read. | |
| value = if conditional | |
| # do some work | |
| # do more work | |
| value1 | |
| else | |
| # do some work | |
| # do more work | |
| value2 | |
| 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
| resources :projects, only: [:create] do | |
| resources :project_parts, only: [:edit, :update] | |
| 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 create | |
| @project = current_user.projects.create | |
| redirect_to edit_project_project_part_path(@project, "basic_info") | |
| 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
| class ProjectPartsController < ApplicationController | |
| before_filter :authenticate_user!, :authorize_project | |
| STEPS = ['basic_info', 'detail', 'document_content', 'preview'] | |
| def edit | |
| if wizard_step_project.editable? | |
| if step.present? | |
| render step | |
| else |
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
| class Project::BasicInfo < Project | |
| validates :business_campaign_name, :presence => true, :length => {:maximum => 255} | |
| validates :money_to_raise_min, :presence => true, :numericality => {:greater_than => 0} | |
| validates :money_to_raise_max, :presence => true, :numericality => {:greater_than => 0} | |
| #add validation that money_to_raise_min is greater than 0 | |
| validates :deadline, :presence => true | |
| validates :name, :presence => true, :length => {:maximum => 255} | |
| validates :company_name, :presence => true, :length => {:maximum => 255} | |
| validates :position_role, :presence => true, :length => {:maximum => 255} | |
| validates :email, :presence => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i |
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
| class Project::Detail < Project | |
| validates :business_concept_mission, presence: true, length: {maximum: 4000} | |
| validates :goals_essay, presence: true, length: {maximum: 4000} | |
| validates :good_investment_proposition, presence: true, length: {maximum: 4000} | |
| after_update :complete! | |
| private | |
| def complete! |
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
| class Project < ActiveRecord::Base | |
| extend FriendlyId | |
| attr_accessible :business_campaign_name, :money_to_raise_min, :money_to_raise_max, :deadline, :name, :company_name, :position_role, :email, :phone, :business_concept_mission, :goals_essay, :good_investment_proposition, :overview, :embedded_media, :tagline, :city, :state, :number_of_employees,:company_website, :facebook, :linkedin, :twitter, :pinterest, :blog, :industry, :company_image, :money_raised, :featured_category, :passcode, :offering_type, :valuation, :tax_id | |
| friendly_id :business_campaign_name, use: :slugged | |
| has_many :documents, :conditions => {:category => 'document'} | |
| has_many :private_documents, :class_name => "Document", :conditions => { :category => 'private_document' } | |
| has_many :events, dependent: :destroy |
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
| <%= form_for @project, :url => project_project_part_path(@project.id, params[:id]), :as => :project} do |f| %> | |
| ... | |
| <% 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
OlderNewer