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
= semantic_form_for :map_listing, :url => import_listings_path, :method => :post, :html => {:multipart => true} do |f| | |
= f.input :file, :as => :file | |
= f.buttons |
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
ruby-1.9.2-p290 :101 > @foo.update_attributes!(suspended_at: Time.zone.now, suspension_reason: "Some foo reason") | |
=> true | |
ruby-1.9.2-p290 :102 > @foo | |
=> #<Listing _id: 4ee230142b36da01d300004d, _type: "listing" ... suspended_at: nil, suspension_reason: nil, ...> |
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
ruby-1.9.2-p290 :001 > params = {"utf8"=>"✓", "authenticity_token"=>"kAizu8XHaZw9Kw1gtUuU22nWl85WQVV5zTzurdWO1M0=", "internship"=>{"report_accepted"=>"true"}, "commit"=>"Change", "locale"=>"en", "id"=>"28"} | |
=> {"utf8"=>"✓", "authenticity_token"=>"kAizu8XHaZw9Kw1gtUuU22nWl85WQVV5zTzurdWO1M0=", "internship"=>{"report_accepted"=>"true"}, "commit"=>"Change", "locale"=>"en", "id"=>"28"} | |
ruby-1.9.2-p290 :002 > params['internship']['report_accepted'] == true | |
=> false | |
ruby-1.9.2-p290 :003 > params['internship']['report_accepted'] == 'true' | |
=> 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 download | |
@email = User.emails.concat(Organization.emails).compact! | |
outfile = "members_" + Time.now.strftime("%D") + ".csv" | |
unless @email.blank? | |
data = CSV.generate do |csv| | |
csv << ['Email'] | |
@email.each do |e| | |
csv << [e] | |
end | |
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 params[:map_listing][:file] | |
file_field = params[:map_listing][:file] | |
session[:map_fields] = {} | |
temp_path = File.join(Dir::tmpdir, "map_fields_#{Time.now.to_i}_#{$$}") | |
File.open(temp_path, 'wb') do |f| | |
f.write file_field.read | |
end | |
session[:map_fields][:file] = temp_path | |
end | |
CSV.foreach(session[:map_fields][:file], { :headers => true, :return_headers => true }) do |row| |
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 Admin::ContentsController < Admin::BaseController | |
before_filter :find_content, :only => [:edit, :update] | |
def index | |
@contents = Content.all | |
end | |
def edit | |
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
%p#missionCopy | |
= raw @mission | |
%p#historyCopy.activeCopy | |
= raw @history | |
%p#newsCopy | |
= raw @news |
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 search | |
search_terms = params[:query] | |
orgs = Listing.search do | |
query { | |
boolean do | |
should { term :short_description, search_terms} | |
should { term :full_description, search_terms} | |
should { term :manufacturers_name, search_terms} | |
should { term :manufacturers_part_num, search_terms} | |
should { term :suppliers_name, search_terms} |
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 Boss::ListingsController < Boss::BaseController | |
def destroy | |
@listings = Listing.where(:listing_name => CGI::unescape(params[:listing_name])) | |
logger.debug "this is my object #{@listings.inspect}" | |
@listings.destroy | |
redirect_to boss_listings_path, :notice => "Successfully destroyed this group of listings." | |
end | |
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
translate('foo_html', :something => '<script>') # => "...<script>..." |