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
| 2.1.4 :004 > MyClass.ancestors | |
| [ | |
| [0] MyClass < Object, | |
| [1] Object < BasicObject, | |
| [2] PP::ObjectMixin, | |
| [3] ERB::Util, | |
| [4] ActiveSupport::Dependencies::Loadable, | |
| [5] JSON::Ext::Generator::GeneratorMethods::Object, | |
| [6] Kernel, | |
| [7] BasicObject |
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
| div class="span12" | |
| table class="table table-hover" | |
| - @list.products.each_with_index do |product, index| | |
| - if !product.id.nil? | |
| tr | |
| td class="span1" | |
| = #TOP FORM | |
| = form_tag(votes_vote_up_path) | |
| = submit_tag "UP" | |
| - if current_user |
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 'subdomain_mapper' | |
| class ApplicationController < ActionController::Base | |
| before_filter :check_whitelabel | |
| def check_whitelabel | |
| sd = SubdomainMapper.new(request.subdomain) | |
| prepend_view_path(sd.whitelabel_view_path) | |
| 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
| ### console output | |
| ### 1.9.3p172 :018 > app.root_path | |
| ### => "/" | |
| # spec/helpers/applcation_helper.rb | |
| require 'spec_helper' | |
| require 'uri' | |
| describe ApplicationHelper do |
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
| # app/helpers/application_helper.rb | |
| module ApplicationHelper | |
| def go_to_page(resource) | |
| polymorphic_path([resource.company, resource]) | |
| end | |
| end | |
| # spec/helpers/application_helper_spec.rb |
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
| 1.8.7 :012 > a = Post.first | |
| Post Load (0.8ms) SELECT "posts".* FROM "posts" LIMIT 1 | |
| => #<Post id: 88, title: "Random Title", created_at: "2012-06-11 06:13:02", updated_at: "2012-06-11 06:47:57"> | |
| 1.8.7 :013 > a.changed? | |
| => false | |
| 1.8.7 :014 > a.title = 'moo' | |
| => "moo" | |
| 1.8.7 :015 > a.changed? | |
| => true | |
| 1.8.7 :016 > Post.first.title = 'moo' |
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
| config.model PagePart do | |
| configure :content do | |
| ckeditor true | |
| 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
| class Post < ActiveRecord::Base | |
| # for SO: http://stackoverflow.com/questions/10481389/friendly-id-with-two-parameters | |
| # EXAMPLE ASSUMES YOU ARE USING FRIENDLYID 4.X | |
| # AND THAT YOU HAVE A SLUG:STRING COLUMN ON THE MODEL | |
| # ... | |
| extend FriendlyId | |
| friendly_id :generate_custom_slug, :use => :slugged | |
| # ... |
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
| Format Meaning | |
| %a The abbreviated weekday name (“Sun’’) | |
| %A The full weekday name (“Sunday’’) | |
| %b The abbreviated month name (“Jan’’) | |
| %B The full month name (“January’’) | |
| %c The preferred local date and time representation | |
| %d Day of the month (01..31) | |
| %H Hour of the day, 24-hour clock (00..23) | |
| %I Hour of the day, 12-hour clock (01..12) | |
| %j Day of the year (001..366) |
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 edit | |
| @profile = Profile.find(params[:username]) | |
| what = params[:what] | |
| if not what.nil? | |
| if ["basics", "location", "details", "photos", "interests"].member?(what) | |
| render :action => "edit_#{what}" | |
| else | |
| render :action => "edit_basics" | |
| end |
NewerOlder