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 'faker' | |
| topics = [] | |
| 15.times do | |
| topics << Topic.create( | |
| name: Faker::Lorem.words(rand(1..10)).join(" "), | |
| description: Faker::Lorem.paragraph(rand(1..4)) | |
| ) | |
| 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
| require 'faker' | |
| topics = [] | |
| 15.times do | |
| topics << Topic.create( | |
| name: Faker::Lorem.words(rand(1..10)).join(" "), | |
| description: Faker::Lorem.paragraph(rand(1..4)) | |
| ) | |
| 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
| #method for your app/models/bookmark.rb | |
| def thumbnail_url | |
| Embedly::API.new.oembed( url: self.url).first.thumbnail_url | |
| 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
| <div class='status'> | |
| <div class='row'> | |
| <div class='span7'> | |
| <strong><%= comment.user.name %></strong> | |
| <p><%= comment.content %></p> | |
| <div class='meta'> | |
| <%= link_to "#{time_ago_in_words(comment.created_at)} ago", comment %> | |
| </div> | |
| </div> | |
| </div> |
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 String | |
| def title_case | |
| articles = ['a','the','of'] | |
| words_array = self.downcase.split(" ") | |
| words_array.each do |word| | |
| unless articles.include?(word) | |
| word.capitalize! | |
| end | |
| end | |
| words_array.first.capitalize! |
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
| <ol> | |
| <% @lawyers_specialty_questions.each do |question| %> | |
| <li><%= question.title %></li> | |
| <% end %> | |
| </ol> | |
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 index | |
| @list = List.find(params[:list_id]) | |
| @items = @list.items | |
| 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 Book | |
| def title_and_author(title, author) | |
| #some stuff | |
| end | |
| def description | |
| #some other stuff | |
| 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 Array | |
| def sum | |
| sum = 0 | |
| self.each do |item| | |
| #some code | |
| end | |
| sum | |
| end | |
| def add_index |
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 File.expand_path('../boot', __FILE__) | |
| # Pick the frameworks you want: | |
| require "active_record/railtie" | |
| require "action_controller/railtie" | |
| require "action_mailer/railtie" | |
| require "active_resource/railtie" | |
| require "sprockets/railtie" | |
| # require "rails/test_unit/railtie" |
OlderNewer