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
# Register your models here. | |
from django.contrib import admin | |
from .models import Question, Choice, Document | |
import os | |
from django.conf import settings | |
def handleBulkDelete(modeladmin, request, queryset): | |
for obj in queryset: | |
path = os.path.join(settings.MEDIA_ROOT, obj.docfile.name) | |
os.unlink(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
Trying to figure out how to use section | |
3.2 Select Boxes for Dealing with Models | |
http://guides.rubyonrails.org/form_helpers.html | |
With my deeply nested models. | |
This takes all the group locations and lists them and lets me add them to the current provider under proivder locations. | |
Basically get what is working 'dumbly' on the controller side upon f.submit |
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
<tr> | |
<td> | |
<% if @group_locations.count >0 %> | |
<%= select_tag "group_providers", options_from_collection_for_select(GroupLocation.all, 'id' ,@group_locations.map{ |j| j.dba }), :multiple => true%> | |
<% else %> | |
<%= select_tag "group_providers", "<option>Add new...</option>".html_safe, :multiple => true, :style => "width: 300px" %> | |
<% end %> | |
</td> | |
</tr> |
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
NoMethodError in ProvidersController#create | |
To respond to a custom format, register it as a MIME type first: http://guides.rubyonrails.org/action_controller_overview.html#restful-downloads. If you meant to respond to a variant like :tablet or :phone, not a custom format, be sure to nest your variant response within a format response: format.html { |html| html.tablet { ... } } | |
Extracted source (around line #44): | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 |
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
<h3> TEST FOR ADD LOCATION </H3> | |
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
# Running: | |
E | |
Finished in 0.108843s, 9.1875 runs/s, 0.0000 assertions/s. | |
1) Error: | |
ProviderTermTest#test_terming_a_provider: | |
ActiveRecord::UnknownAttributeError: unknown attribute: provider | |
test/models/provider_term_test.rb:17:in `block in <class:ProviderTermTest>' |
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 CreateGroupsAddressJoinTable < ActiveRecord::Migration | |
def change | |
create_join_table(:groups, :addresses, 'group_locations') do |t| | |
# t.index [:group_id, :address_id] | |
t.index :address_id | |
t.index :group_id | |
t.integer :address_id | |
t.integer :group_id | |
end |