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
<h1>New product</h1> | |
<% @images.each do |image| %> | |
<%= image_tag image %> | |
<% end %> | |
<%= link_to 'Back', products_path %> |
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
/* | |
* This is a manifest file that'll be compiled into application.css, which will include all the files | |
* listed below. | |
* | |
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | |
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. | |
* | |
* You're free to add application-wide styles to this file and they'll appear at the top of the | |
* compiled file, but it's generally better to create a new file per style scope. | |
* |
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
############## views/products/_trending.html.erb ############### | |
<% @products.each do |product| %> | |
<div class="product"> | |
<%= link_to (image_tag product.thumbnail), product %> | |
<div class="product-overlay-details"> | |
<%= product.name %>... | |
</div> | |
</div> | |
<% 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
############ Models ############ | |
class Fund < ActiveRecord::Base | |
attr_accessible :name | |
has_many :portfolios | |
end | |
class Investment < ActiveRecord::Base |
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 Stock < ActiveRecord::Base | |
attr_accessible :issuer, :portfolio_id | |
has_many :portfolios_stocks | |
has_many :portfolios, :through => :portfolios_stocks | |
end | |
class Portfolio < ActiveRecord::Base |
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
Fund | |
has_many :portfolios | |
Portfolio | |
belongs_to :fund | |
has_many :stocks, :through => :portfolios_stocks # join table | |
portfolios_stocks |