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
def self.get_options | |
self.all.collect do |x| | |
[x.name, x.id] | |
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
#form | |
<%= form_for [@site, @detail] do |f| %> | |
<table id='amenities'> | |
<thead> | |
<th> Rank </th> | |
<th> Value </th> | |
</thead> | |
<%= f.fields_for :amenities do |af| %> | |
<tr> | |
<td><%= af.text_field :rank, :size => 1 %></td> |
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 Calendar < ActiveRecord::Base | |
has_many :reservations | |
end | |
class Reservation < ActiveRecord::Base | |
belongs_to :calendar | |
def self.search(search_fields) | |
results = self #this is where I'd like to access the collection search was called on |
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
ActionController::Routing::Routes.draw do |map| | |
map.resources :user_sessions | |
map.resources :sites, :users | |
map.resources :sites, :member => { :encode => :get, :decode => :get } | |
map.login "login", :controller => "user_sessions", :action => "new" | |
map.logout "logout", :controller => "user_sessions", :action => "destroy" | |
map.root :login |
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
$(document).ready(function(){ | |
$('.init').click(function(event){ | |
$.getJSON("http://localhost:37280/sites/1/encode?callback=?", { key: $("#target").attr('value') }, function(data){ | |
alert(data); | |
}); | |
event.preventDefault(); | |
}); | |
}); |
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
Development: | |
[HomePagesController, ApplicationController, UrlHelper, ActionController::Base, Devise::Controllers::Helpers, TinyMCE::Base, TinyMCE::SpellChecker, #<Module:0x00000001eb2278>, ActionDispatch::Routing::Helpers, #<Module:0x00000002ac2950>, ActiveRecord::Railties::ControllerRuntime, Devise::Controllers::UrlHelpers, ActionController::Compatibility, ActionController::Rescue, ActiveSupport::Rescuable, ActionController::Instrumentation, ActionController::HttpAuthentication::Token::ControllerMethods, ActionController::HttpAuthentication::Digest::ControllerMethods, ActionController::HttpAuthentication::Basic::ControllerMethods, ActionController::RecordIdentifier, ActionController::Streaming, ActionController::RequestForgeryProtection, AbstractController::Callbacks, ActiveSupport::Callbacks, ActionController::Flash, ActionController::Cookies, ActionController::ImplicitRender, ActionController::MimeResponds, ActionController::Caching, ActionController::Caching::Fragments, ActionController::Caching::Config |
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
Dev: | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Helpers::FormTagHelper! | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Helpers::FormHelper! | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Helpers::InstanceTag! | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Helpers! | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Base! | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Base! | |
ActionView::Helpers::UrlHelper WAS INCLUDED IN ActionView::Base! |
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 ActiveRecord::Base | |
module SaveAsDraft | |
def save | |
if self.has_attribute?(:record_status) and self.record_status == "Draft" | |
super(:validate => false) | |
else | |
super | |
end | |
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 ActiveRecord::Base | |
module SaveAsDraft | |
def save | |
if self.has_attribute?(:record_status) and self.record_status == "Draft" | |
super(:validate => false) | |
else | |
super | |
end | |
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
require 'active_record' | |
module SaveAsDraft | |
ActiveRecord::Base.class_eval do | |
alias_method :save_without_draft, :save | |
def save_with_draft | |
if self.has_attribute?(:record_status) and self.record_status == "Draft" | |
save_without_draft(:validate => false) | |
else |
OlderNewer