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 | |
| @work = Work.new(:swfupload_file => params[:Filedata]) | |
| if @work.save | |
| render :partial => 'work', :object => @work | |
| else | |
| render :text => "error" | |
| 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
| #views/root/index.html.erb | |
| <%= link_to 'Home', root_path, :class => 'hide ' + is_page?('root'), :id => 'nav-home' %> | |
| #application_helper.rb | |
| def is_page?(t) | |
| return 'here' if t == params[:controller] | |
| return 'menu' | |
| end | |
| #error resolved! |
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
| #view | |
| <div id="twitter"> | |
| <h3 class="hide">Recent Tweets</h3> | |
| <ul> | |
| <% @tweets.each do |tweet| -%> | |
| <li class="tweet"> | |
| <%= tweet.title.gsub!('simplifyadvance: ', '') %> | |
| <strong class="date"><%= tweet.pubDate.strftime("%l:%M %p %b %e") %></strong> | |
| </li> | |
| <% 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 RssReader | |
| require 'timeout' | |
| def self.posts_for(feed_url, length=2, perform_validation=false) | |
| posts = [] | |
| retries = 42 | |
| begin | |
| Timeout::timeout(5){ |
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
| git clone git://github.com/activefx/restful_authentication_tutorial.git |
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 Gallery < ActiveRecord::Base | |
| belongs_to :user | |
| has_many :photos, :dependent => :destroy | |
| validates_presence_of :title | |
| acts_as_urlnameable :title, :overwrite => true | |
| def to_param | |
| urlname | |
| 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
| script/generate model photo gallery_id:integer | |
| script/generate paperclip photo image |
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 Photo < ActiveRecord::Base | |
| belongs_to :gallery | |
| has_attached_file :image, | |
| :styles => { :large => "640x480>", | |
| :medium => "150x150#", | |
| :thumb => "75x75#" } | |
| validates_attachment_presence :image | |
| validates_attachment_content_type :image, | |
| :content_type => ['image/jpeg', 'image/jpg'] |
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
| require 'digest/sha1' | |
| class User < ActiveRecord::Base | |
| # ... | |
| has_many :galleries | |
| # ... | |
| 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
| script/generate controller photos create update destroy |
OlderNewer