Skip to content

Instantly share code, notes, and snippets.

# views/surveys/_form.html.erb
<%= form_for @survey do |f| %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p><%= f.submit "Submit" %></p>
<% end %>
Table "comments"
Column | Type |
--------------------------+-----------------------------+
id | integer |
author | character varying(255) |
email | character varying(255) |
comment | text |
post_id | integer |
created_at | timestamp without time zone |
updated_at | timestamp without time zone |
class Modelo < ActiveRecord::Base
attr_accessor :nuevo_campo
before_save :analizar
def analizar
@nuevo_campo == "ALUN VALOR"
end
end
ActionView::Template::Error (undefined method `[]' for nil:NilClass):
3: %meta{ itemprop: "name", content: product.name }
4: %meta{ itemprop: 'image', content: product.master.images.first.attachment_file_name }
5: %meta{ itemprop: 'description', content: product.description }
6: %meta{ itemprop: "category", content: get_category(categories, product) }
7: %meta{ itemprop: "identifier", content: "sku: #{product.master.sku}" }
8:
9: %span{ itemprop: "review", itemscope: "", itemtype: "http://data-vocabulary.org/Review-aggregate" }
app/helpers/products_helper.rb:6:in `get_category'
app/views/home/_rich_snippets.html.haml:6:in `_4f731d49533689a0d15bd689dd92489a'
module ApplicationHelper
#
# Return the colums style
#
def get_column_style
return 3 if products_index
return 'left' if products_show || taxons_show
return 'right' if products_show
1
@jparbros
jparbros / gist:aa1aa35e5a3c5585c9e6
Created September 18, 2014 21:56
borrar tablas JS
drop table if exists "schema_migrations" cascade;
drop table if exists "spree_addresses" cascade;
drop table if exists "spree_adjustments" cascade;
drop table if exists "spree_alternate_catalog_numbers" cascade;
drop table if exists "spree_assets" cascade;
drop table if exists "spree_brands" cascade;
drop table if exists "spree_calculators" cascade;
drop table if exists "spree_color_groups" cascade;
drop table if exists "spree_color_groups_option_values" cascade;
drop table if exists "spree_option_types" cascade;
oz = Spree::Country.find_by_iso('AU')
oz.states << Spree::State.create(:name => 'Australian Capital Territory', :abbr => 'ACT')
oz.states << Spree::State.create(:name => 'New South Wales', :abbr => 'NSW')
oz.states << Spree::State.create(:name => 'Victoria', :abbr => 'VIC')
oz.states << Spree::State.create(:name => 'Tasmania', :abbr => 'TAS')
oz.states << Spree::State.create(:name => 'Queensland', :abbr => 'QLD')
oz.states << Spree::State.create(:name => 'South Australia', :abbr => 'SA')
oz.states << Spree::State.create(:name => 'Western Australia', :abbr => 'WA')
oz.states << Spree::State.create(:name => 'Northern Territory', :abbr => 'NT')
gb = Spree::Country.find_by_iso('GB')
gb.states << Spree::State.create(abbr: 'ABD', name:'Aberdeenshire')
gb.states << Spree::State.create(abbr: 'AGY', name:'Anglesey')
gb.states << Spree::State.create(abbr: 'ALD', name:'Alderney')
gb.states << Spree::State.create(abbr: 'ANS', name:'Angus')
gb.states << Spree::State.create(abbr: 'ANT', name:'Co. Antrim')
gb.states << Spree::State.create(abbr: 'ARL', name:'Argyllshire')
gb.states << Spree::State.create(abbr: 'ARM', name:'Co. Armagh')
gb.states << Spree::State.create(abbr: 'AVN', name:'Avon')
gb.states << Spree::State.create(abbr: 'AYR', name:'Ayrshire')
@jparbros
jparbros / gist:5bcde05c55653bb174dd
Last active August 29, 2015 14:09
Code Retrear 2014 Colima
Code Retreat 2014 Colima
Ejercicio: KataBankOCR
http://codingdojo.org/cgi-bin/index.pl?KataBankOCR
Los primeros 10 minutos de cada iteración en papel.
Una caja lápices
Borradores
worker_processes 4;
events {
worker_connections 1024;
}
client_body_buffer_size 256K;
client_header_buffer_size 64k;
client_max_body_size 8m;
large_client_header_buffers 8 1024k;