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([:admin, @stencil]) do |f| | |
- if @stencil.errors.any? | |
#error_explanation | |
%h2 | |
= pluralize(@stencil.errors.count, "error") | |
prohibited this stencil from being saved: | |
%ul | |
- @stencil.errors.full_messages.each do |msg| | |
%li= msg | |
.field |
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 */ | |
<form action="/topics" id="new_topic_form" method="post" onsubmit="new Ajax.Request('/topics', {asynchronous:true, evalScripts:true, method:'post', onComplete:function(request){Form.Element.enable('add_topic_submit')}, onLoading:function(request){Form.Element.disable('add_topic_submit')}, parameters:Form.serialize(this)}); return false;"> | |
<div style="margin:0;padding:0;display:inline"> | |
<input name="authenticity_token" type="hidden" value="6sukkqZzoOtj09Z/vJvkgn00m5PrbdjG3n7DFffaQA0=" /> | |
</div> | |
<input id="topic_slideshow_id" name="topic[slideshow_id]" type="hidden" value="107" /> | |
<label for="topic_title">Title</label> | |
<br /> | |
<input id="new_topic_title_field" name="topic[title]" size="30" type="text" /> | |
<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
# Put this file with your initializers | |
# Altering error messages to only show the attribute name in the error message, | |
# if the error message starts with a lower-case character | |
if RAILS_GEM_VERSION =~ /^2\.3\.5/ | |
class ActiveRecord::Error | |
def full_message | |
if attribute.to_s == 'base' || message =~ /^[[:upper:]]/ | |
message |
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 |
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
# 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
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
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
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
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 |