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 pending_orders? | |
| Order.where(:status => Order::PENDING, :user_id => self.id).exists? | |
| 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 Product < ActiveRecord::Base | |
| has_many :products_materials | |
| has_many :materials, :through => :products_materials | |
| end | |
| class Material < ActiveRecord::Base | |
| has_many :products_materials | |
| has_many :products, :through => :products_materials | |
| 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
| def published_or_authenticated | |
| scope = controller.name.gsub(/Controller$/, '').singularize.constantize.scoped | |
| scope = user_signed_in? ? scope : scope.published | |
| @page = scope.find(params[:id]) | |
| 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Site</title> | |
| <%= stylesheet_link_tag "application" %> | |
| <%= javascript_include_tag "application" %> | |
| <%= javascript_include_tag "success" %> | |
| <%= csrf_meta_tags %> | |
| </head> | |
| <body class="<%= yield(:class) %>"> |
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
| # Be sure to restart your server when you modify this file. | |
| # | |
| # This file contains settings for ActionController::ParamsWrapper which | |
| # is enabled by default. | |
| # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. | |
| ActiveSupport.on_load(:action_controller) do | |
| wrap_parameters :format => [:json] | |
| 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
| content_tag :h1 do | |
| [ project.title, | |
| link_to_icon('show', project) | |
| ].join(' ') | |
| 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
| gem 'pg' |
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 create | |
| @device = Device.new(params[:device].merge(:user => current_user)) | |
| respond_with @device | |
| 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
| <% if Spree::Config[:address_requires_state] %> | |
| <% have_states = !@order.ship_address.country.states.empty? %> | |
| <%= ship_form.label :state, t(:state) %><span>*</span> | |
| <noscript> | |
| <%= ship_form.text_field :state_name %> | |
| </noscript> | |
| <% state_elements = [ | |
| ship_form.collection_select(:state_id, @order.ship_address.country.states, | |
| :id, :name, | |
| {:include_blank => true}, |
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 order_subtotal(order, options={}) | |
| options.assert_valid_keys(:format_as_currency, :show_vat_text) | |
| options.reverse_merge! :format_as_currency => true, :show_vat_text => true | |
| amount = order.total | |
| options.delete(:format_as_currency) ? number_to_currency(amount, :format => "<span>%u</span>%n" : amount | |
| end |