This file contains 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
<%= link_to(image_tag(gallery.header_image, class: "shadow", height: '166', width: '550'), procedure_gallery_path(procedure, gallery)) %> | |
<% if current_user %> | |
<p> | |
<%= link_to 'Edit', edit_procedure_gallery_path(procedure, gallery), class: "edit-margin" %> | | |
<%= link_to 'Delete Image', procedure_gallery_path(procedure, gallery), method: :delete, data: { confirm: 'Are you sure?' } %> | |
</p> | |
<% end %> |
This file contains 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_location_with_random_trait(options = {}) | |
# there might be a way to retrieve this from the factory girl object directly to avoid duplicat | |
trait = [:trait1, :trait2, :trait3].sample | |
FactoryGirl.create(:location, trait, options) | |
end | |
# OR | |
module FactoryGirl |
This file contains 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
ActiveAdmin.register OleCore::Subscription, as: "Subscriptions" do | |
controller do | |
def scoped_collection | |
resource_class.includes(:account) | |
end | |
end | |
filter :id | |
index do |
This file contains 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
ActiveAdmin.register OleCore::Subscription, as: "Subscriptions" do | |
controller do | |
def scoped_collection | |
resource_class.includes(:account) | |
end | |
end | |
filter :id | |
filter :account_name, as: :string | |
filter :trial_expiry_at |
This file contains 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 User | |
attr_accessible :full_name | |
belongs_to :company | |
end | |
class Company | |
attr_accessible :name | |
has_many :users | |
has_one :primary_admin, class_name: 'User', conditions: ['users.primary_admin = true'] |
This file contains 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 ChargifySubscription < SimpleDelegator | |
def addons_count | |
# Implementacion aqui | |
end | |
def price | |
# Implementacion aqui | |
end | |
end |
This file contains 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 Husband < ActiveRecord::Base | |
attr_accessible :full_name | |
has_one :wife | |
end | |
class Wife < ActiveRecord::Base | |
attr_accessible :full_name | |
belongs_to :husband | |
end |
This file contains 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
# (Rails 3.2) | |
# Number of Units in the system: 30,000 | |
# Number of Courses in the system: 50. | |
# Unit: | |
# Properties | |
# -- active: boolean | |
# -- course_id: int |
This file contains 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 Author < ActiveRecord::Base | |
attr_accessible :name, :admin # :name => string, :admin => boolean | |
has_many :posts | |
end | |
class Post < ActiveRecord::Base | |
attr_accessible :name, :description # :author_id => int, :name => string, :description => string | |
belongs_to :author | |
has_many :comments | |
end |
This file contains 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
module ApplicationHelper | |
def pretty_user_name | |
"<span class='pretty'>" + @user.first_name + " " + @user.last_name + "</span>" | |
end | |
end |