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
## | |
# A Rake interface to creating a tunnel using ssh. | |
# This file originally comes with the facebooker gem for Ruby on Rails: http://github.com/mmangino/facebooker | |
# | |
# How to use: | |
# 1. Simply put it at a proper place. e.g. lib/tasks/ in your Rails application | |
# 2. Create a config file 'easy_tunnel.yml' like following: | |
# | |
# development: | |
# public_host_username: host_user_name |
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
# load facebook information for this environment | |
# | |
# 1. Put this file in config/initializers/load_koala_facebook.rb | |
# | |
# 2. Create config/facebook.yml as following | |
# | |
# development: | |
# api_key: <API_KEY> | |
# secret_key: <SECRET_KEY> | |
# app_id: <APP_ID> |
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 TemplatesController < ApplicationController | |
# | |
# The template which is going to be destroyed is | |
# last_accessed_template of current user. If | |
# template is destroyed and updation fails, user | |
# in the database will refenrence a destroyed template. | |
# | |
# How to handle above situation? | |
# |
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
When you want to create an object and save it in one fell swoop, you can use the create method. Use it now to create another article: | |
>> Article.create(:title => "Some Fancy Title") | |
=> #<Article id: 4, title: "Some Fancy Title" > | |
Instead of returning true or false, the create method returns the object it created - in this case, an Article object. You're actually passing a hash of attributes to the create method. Although hashes are normally surrounded by curly braces, when a hash is only argument to a Ruby method, the braces are optional. You can just as easily create the attributes hash first and then give that to create: | |
>> attributes = { :titile => "Some other Fancy Title } | |
>> Article.create(attributes) | |
=> #<Article id: 5, title: "Some other Fancy Title" > |
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
Parameters: { "listing_services_attributes"=>{"0"=>{"service_attributes"=>{"name"=>"Fruits", "id"=>"6274"}}, "1"=>{"service_attributes"=>{"name"=>"Mocha"}}, "2"=>{"service_attributes"=>{"name"=>"Mocha"}}, "3"=>{"service_attributes"=>{"name"=>""}}, "4"=>{"service_attributes"=>{"name"=>""}}}} | |
Admin Load (0.1ms) SELECT `users`.* FROM `users` WHERE (`users`.`type` = 'Admin') AND (`users`.`id` = 3) LIMIT 1 | |
Category Load (0.3ms) SELECT `categories`.* FROM `categories` WHERE (categories.category_id IS NULL) ORDER BY name ASC | |
Category Load (0.4ms) SELECT `categories`.* FROM `categories` WHERE (`categories`.category_id IN (1,40,182,244,26,306,330,12,60,75,206,135,195,260,318,341,8,70,87,163,288,324)) ORDER BY name ASC | |
Location Load (0.2ms) SELECT `locations`.* FROM `locations` | |
Location Load (0.1ms) SELECT `locations`.* FROM `locations` WHERE (`locations`.`name` = 'Agege') LIMIT 1 | |
Completed in 1272ms | |
ActiveRecord::RecordNotFound (Couldn't find Service with ID=6 |
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
gem 'cramp' | |
gem 'erubis', '2.6.5' | |
gem 'usher', "0.6.0" |
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 SmsNoticesController < ApplicationController | |
def create | |
listing = Listing.find(params[:listing_id]) | |
sms = Sms.new(listing.name, params[:phone_number]) | |
if sms.deliver | |
flash[:notice] = "SMS sent successfully." | |
else | |
flash[:alert] = "Something went wrong. Please try sending SMS again." | |
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_tag(new_invitations_invitations_path, :remote => true) do %> | |
<%= hidden_field_tag(:provider, "yahoo") %> | |
<dl> | |
<dt><strong>Your email:</strong></dt> | |
<dd><%= text_field_tag('email') %></dd> | |
</dl> | |
<dl> | |
<dt><strong>Password:</strong></dt> | |
<dd><%= password_field_tag('pass') %></dd> | |
</dl> |
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
resources :meetings, :only => [:index] do | |
resources :bookings | |
end | |
resources :bookings |
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.all | |
results = [] | |
ObjectSpace.each_object(Class) do |c| | |
(results << c) if c < PullSource | |
end | |
results | |
end |
OlderNewer