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
# instead of using the "binary" type suggested by the README, use a "longblob" type (at least, in mysql) | |
create_table :db_files do |t| | |
t.column :data, :longblob | |
end | |
# to send the file in your controller | |
# if photo is the object using attachment_fu | |
def download | |
send_data( photo.current_data, :type => photo.content_type, :filename => photo.filename, :disposition => 'attachment' ) | |
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
<% remote_form_for 'document', Document.new, :url => documents_url, :html => {:multipart => true}, | |
:loading => "$('indicator').show();", | |
:loaded => "$('indicator').hide();", | |
:update => {:failure => "new_document_errors"}, | |
:success => "parent.location = request.responseText;" do |f| %> |
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
app = window.app = { | |
doSomething: -> | |
jQuery.ajax | |
type : "POST" | |
path : "/" | |
datatype : "JSON" | |
data : { arraystuff : [ { foo : "bar" }, { bar : "baz" }, { baz : "bop" } ] } | |
return |
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
<script type="text/javascript"> | |
$(document).ready(function() { | |
$("#sparkline").sparkline([5,6,7,5,6,8,6,], { | |
type: 'bar', | |
barWidth: 6, | |
zeroAxis: false, | |
barColor: '#999999'}); | |
}); | |
</script> |
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
/Users/username/.rvm/gems/ruby-2.0.0-p0@rails4/bin/ruby_noexec_wrapper: [BUG] Bus Error | |
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] | |
-- Crash Report log information -------------------------------------------- | |
See Crash Report log file under the one of following: | |
* ~/Library/Logs/CrashReporter | |
* /Library/Logs/CrashReporter | |
* ~/Library/Logs/DiagnosticReports | |
* /Library/Logs/DiagnosticReports | |
the more detail of. |
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 Customer | |
attr_reader :id, :datasource | |
def initialize(id, datasource) | |
@id = id | |
@datasource = datasource | |
end | |
def first | |
value = datasource.get_first_value(id) |
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 Customer | |
attr_reader :id, :datasource | |
def initialize(id, datasource) | |
@id = id | |
@datasource = datasource | |
end | |
def first | |
field :first |
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 Customer | |
attr_reader :id, :datasource | |
def initialize(id, datasource) | |
@id = id | |
@datasource = datasource | |
end | |
def self.has_field(fieldname) | |
define_method fieldname 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
class Customer | |
attr_reader :id, :datasource | |
def initialize(id, datasource) | |
@id = id | |
@datasource = datasource | |
@datasource.methods.grep(/^get_(.*)_value/) { Customer.has_field $1 } | |
end | |
def self.has_field(fieldname) |
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 Customer | |
attr_reader :id, :datasource | |
def initialize(id, datasource) | |
@id = id | |
@datasource = datasource | |
end | |
def method_missing(methodname, *args, &block) | |
super unless @datasource.respond_to? "get_#{methodname}_value" |
OlderNewer