My Recent Pastes (9 and counting)

Recent Pasties by silkcom (9 and counting)

Below are summaries of the 9 most recent pasties by silkcom.

May 27, 2008
12:14PM EDT
by silkcom

1
2
3
4
5
class Photo < ActiveRecord::Base
  has_attachment :content_type => :image,
  :storage => :file_system,
  :resize_to => '800x600>',
  :thumbnails => { :thumb => '80x80>', :main => '375x375>'},

May 21, 2008
10:48PM EDT
by silkcom

1
2
3
4
5
## memory_requests.rb
class MemoryRequests < ActiveRecord::Base
  belongs_to :user
  belongs_to :requester, :class_name => "user", :foreign_key => "requester_id"   
end

May 13, 2008
8:47PM EDT
by silkcom

1
2
3
4
5
## code
                  <label for="keyword_selected">Select a Keyword:</label>
                  <%= collection_select ('keyword', 'selected', [{:id => 0, :word => "New Keyword"},@books].flatten, :id, :word) %>

## question

May 07, 2008
1:15PM EDT
by silkcom

1
2
3
4
5
[#<Comment id: 7, blog_id: 1, user_id: 1, text: "testing comment 1", created_at: "2008-04-30 12:20:33", updated_at: "2008-04-30 12:20:33">, #<Comment id: 8, blog_id: 1, user_id: 1, text: "new comment", created_at: "2008-05-07 10:57:44", updated_at: "2008-05-07 10:57:44">]
                <% for blog in @blogs %>

                                            <% lastcomment = blog.comments(:first, :order => "updated_at DESC") %>
                                                <%= lastcomment.inspect %>

May 05, 2008
11:44AM EDT
by silkcom

1
2
3
4
5
## controller
def index
  @groupNotes = Group.getNotes(@current_user)  # this gets all the notes that are shared to this group
  @friendNotes = User.getNotes(@current_user)  # this gets all the notes that are shared to this user
  

May 01, 2008
11:53AM EDT
by silkcom

1
2
3
4
5
## user controller

def edit_profile
  @user = session[:user]
    if request.post?

April 18, 2008
12:20PM EDT
by silkcom

1
2
3
4
5
## my line
    # genericNastyQuery returns the sql for the whole thing.  I use it several ways
    # inStatement is just a string
    sql = genericNastyQuery("Count(User.id) as 'count' ", inStatement)
    @countForUser = User.find_by_sql(sql).first.map{ |i| i.count } > 0?

April 17, 2008
5:37PM EDT
by silkcom

1
2
3
4
5
## user.rb
        has_many :groups
  
        has_many :friendships
        has_many :friends, :through => :friendships, :conditions => ['friendships.accepted = ?', true]

April 17, 2008
2:19PM EDT
by silkcom

1
2
3
4
5
       sql =  "SELECT DISTINCT * " +
        "FROM `memories` AS Memory " +
        "JOIN `anchors_memories` AS AnchorLink ON ( Memory.user_id " +
        "IN ( " +
        " " +