Last active
November 16, 2015 23:42
-
-
Save codejoy/19be7b182e372dd98e76 to your computer and use it in GitHub Desktop.
add_location.html.erb
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
I know the error is here: | |
<%= select_tag "provider_locations", options_from_collection_for_select(GroupLocation.all, 'group_location_id' ,@provider.provider_locations.map{ |j| j.id }), :multiple => true%> | |
I have to admit I found this code from another example online and tried to form it to fit my needs, but I have no idea what I am doing with that helper.... or map really | |
I am trying to list all the group locations that the provider has under them. Above are the models and relationships. | |
TypeError in Providers#add_location | |
Showing /vagrant/ipanmv2/app/views/providers/add_location.html.erb where line #51 raised: | |
["TestinGroupLocation Main Main"] is not a symbol nor a string | |
Extracted source (around line #51): | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
<tr> | |
<td> | |
<% if @group_locations.count >0 %> | |
<%= select_tag "group_providers", options_from_collection_for_select(GroupLocation.all, 'dba' ,@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 %> | |
Rails.root: /vagrant/ipanmv2 | |
Application Trace | Framework Trace | Full Trace | |
app/views/providers/add_location.html.erb:51:in `_app_views_providers_add_location_html_erb__410977632_88579590' | |
Request | |
Parameters: | |
{"id"=>"4"} | |
Toggle session dump | |
Toggle env dump | |
Response | |
Headers: | |
None |
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 GroupLocation < ActiveRecord::Base | |
belongs_to :address | |
belongs_to :group | |
has_many :provider_locations | |
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
class Provider < ActiveRecord::Base | |
validates :first_name, presence: true | |
validates :last_name, presence: true | |
validates :provider_contact, presence: true | |
has_many :provider_locations | |
has_many :group_locations, through: :provider_locations | |
has_many :groups, through: :group_locations | |
belongs_to :designation | |
belongs_to :specialty | |
#has_many :provider_locations | |
has_many :invoices | |
has_many :provider_terms | |
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
class ProviderLocation < ActiveRecord::Base | |
belongs_to :provider | |
belongs_to :group_location | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment