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 @person, :url => { :action => "update" } do |person_form| %> | |
| ... | |
| <% @person.projects.each do |project| %> | |
| <% if project.active? %> | |
| <% person_form.fields_for :projects, project do |project_fields| %> | |
| Name: <%= project_fields.text_field :name %> | |
| <% end %> | |
| <% end %> | |
| <% 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
| puts 'What\'s on your mind, son?' | |
| question = gets.chomp | |
| while question != question.upcase | |
| puts 'WHAT?! SPEAK UP SON!' | |
| question = gets.chomp | |
| if question == question.upcase | |
| millenium = 1930 | |
| year = millenium + rand(20) | |
| puts 'NO, NOT SINCE '+ year.to_s + '!' | |
| 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 UserSessionsController < ApplicationController | |
| def new | |
| @user_session = UserSession.new | |
| end | |
| def create | |
| @user_session = UserSession.new(params[:user_session]) | |
| if @user_session.save | |
| flash[:notice] = "Successfully logged in." | |
| redirect_to root_url |
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
| puts 'Enter a starting year:' | |
| startingyear= gets.chomp | |
| puts 'Starting year is now ' + startingyear | |
| puts 'Now enter an ending year' | |
| endingyear = gets.chomp | |
| puts 'Ending year is now ' + endingyear | |
| startingyear.to_i.upto(endingyear.to_i) do |i| | |
| if(i % 4 == 0 AND i % 100 != 0) | |
| puts 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 Designer < ActiveRecord::Base | |
| has_one :login, :as => :user, :dependent => :destroy | |
| accepts_nested_attributes_for :login | |
| 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 User < ActiveRecord::Base | |
| belongs_to :userable, :polymorphic => true | |
| end | |
| class Designer < ActiveRecord::Base | |
| has_one :user_login, :as => :userable | |
| accepts_nested_attributes_for :user_login | |
| end | |
| class DesignersController < ApplicationController |
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
| respond_to do |format| | |
| format.html { do_your_counting here } | |
| 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
| # IN RJS | |
| page.replace_html "client_informations", :partial => 'shared/client_billing_form', :locals => {:client => @client} | |
| # IN _client_billing_form | |
| %p | |
| = remote_form_for client, :controller => 'clients', :action =>'update_billing_from_editor', :id => client.id, :method => :put do |f| | |
| = render :partial => 'shared/client_billing_info_fields', :locals => {:f => f, :client => client} | |
| %br | |
| = f.submit "Correct Informations", :class => "button green" |
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 client.is_company? | |
| - hide = "" | |
| - else | |
| - hide = "hidden" | |
| #company_information{:class => "#{hide}"} | |
| %div | |
| %br/ | |
| = f.label :company_name | |
| %br/ |
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 waiting? | |
| if status == "waiting" | |
| true | |
| else | |
| false | |
| end | |
| end |