My Recent Pastes (97 and counting)
Pastes by celeretaudax (97 and counting)
Below are the 15 most recent pasties by celeretaudax.
October 28, 2008
8:57PM EDT
by celeretaudax
View all 18 lines
## profile_controller.rb before_filter :get_user protected
October 28, 2008
1:35PM EDT
by celeretaudax
View all 348 lines
##show.html.erb <% if @user = current_user %> <%= render :partial => 'profiles/about_me_edit_button' %> <% end %>
October 28, 2008
1:25PM EDT
by celeretaudax
@tags.each do |element| element.sub! "#{element}", "<%= link_to('#{element}', :url => { :controller => 'tags', :action => '#{element}' }) %>" end
October 28, 2008
1:22PM EDT
by celeretaudax
@tags.each do |element| element.sub! "#{element}", "#{link_to(element, :url => { :controller => 'tags', :action => element})}" end
October 28, 2008
1:17PM EDT
by celeretaudax
<%= link_to_function("Edit", nil, :id => "about_me_edit_button") do |page| page[:about_me].replace :partial => 'profiles/about_me_form' page[:about_me_edit_button].replace :partial => 'profiles/about_me_cancel_button' end %>
October 27, 2008
11:48PM EDT
by celeretaudax
View all 118 lines
#very rudimentary version to get you started <div id="about_me_form"> <%= link_to_function("cancel", nil, :id => "about_me_edit_button") do |page| page[:about_me].toggle
October 27, 2008
10:55PM EDT
by celeretaudax
<script type="text/javascript"> $(document).ready(function() { $('about_me_form').hide(); }); </script>
October 20, 2008
8:49PM EDT
by celeretaudax
View all 20 lines
def test_bad_signup #check we can't signup without all required fields post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" , :email => "newbob@mcbob.com"} assert_response 302 assert(record.errors.invalid?(:password))
October 20, 2008
2:14AM EDT
by celeretaudax
View all 20 lines
def test_bad_signup #check we can't signup without all required fields post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" , :email => "newbob@mcbob.com"} assert_response 302 assert(record.errors.invalid?(:password))
May 26, 2008
11:57PM EDT
by celeretaudax
View all 9 lines
def search_vendors if params[:name] == 'Add New Vendor' # if they want to add vendor params[:vendor_id] = Vendor.new @vendors = Vendor.find(:all) render :partial => 'newvendorfrompo'
May 26, 2008
11:53PM EDT
by celeretaudax
View all 11 lines
##make a helper method out of something like this case request.user_agent when /(gecko|opera|konqueror|khtml|webkit)/i return :gecko when /msie\s+7\.\d+/i
May 26, 2008
11:20PM EDT
by celeretaudax
View all 46 lines
var map; var centerLatitude = 40.6897; var centerLongitude = -95.0446; var startZoom = 3;
May 24, 2008
6:23PM EDT
by celeretaudax
View all 13 lines
##book.rb has_many :reviews, :dependent => :delete_all do def overall_rating(record) to_a.sum(&record) end
May 24, 2008
4:59PM EDT
by celeretaudax
>> p = Book.find(1) => #<Book id: 2, firstname: "Zach", lastname: "Wentz", approved: true, overall: nil, rating1: nil, rating2: nil, rating3: nil, rating4: nil, created_at: "2008-05-23 17:18:18", updated_at: "2008-05-24 14:16:30"> >> p.reviews => [#<Review id: 4, rating1: 1, rating2: 1, rating3: 1, rating4: 1, overall: 1, title: "This is my review", body: "Reviewing this mothahfuckah!", user_id: 1, book_id: 2, reccommend: nil, reported: nil, rating_count: 1, rating_total: 5, rating_avg: #<BigDecimal:b6f18c0c,'0.5E1',4(8)>, created_at: "2008-05-23 17:18:47", updated_at: "2008-05-23 22:27:09">, #<Review id: 5, rating1: 4, rating2: 4, rating3: 4, rating4: 4, overall: 4, title: "Nothing FooBAr", body: "Foobar", user_id: 2, book_id: 2, reccommend: nil, reported: nil, rating_count: 0, rating_total: 0, rating_avg: #<BigDecimal:b6f18590,'0.0',4(8)>, created_at: "2008-05-23 22:13:31", updated_at: "2008-05-23 22:13:31">]
May 22, 2008
11:16PM EDT
by celeretaudax
View all 52 lines
## edit.html.erb <% form_tag url_for(:action => "update") do %> <p><label for="old_password" class="block">Old Password</label><br /> <%= password_field_tag 'old_password', @old_password, :size => 45 %></p>
