Last active
July 27, 2016 13:30
-
-
Save universal/22d19c0f3f67453fe893fa1007ac9048 to your computer and use it in GitHub Desktop.
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
## ERROR | |
Showing c:/Sites/postgreSQL_test/app/views/welcome/index.html.erb where line #9 raised: | |
undefined method `each' for nil:NilClass | |
Marked: <% @result.each do |element| %> |
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
<Table> | |
<tr> | |
<th>Key</th> | |
<th>Value</th> | |
</tr> | |
<% @result.each do |element| %> | |
<% element.each do |key, value| %> | |
<tr> | |
<td> | |
<%= key %> | |
</td> | |
<td> | |
<%= value %> | |
</td> | |
</tr> | |
<% end %> | |
<% end %> | |
<Table> |
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 Project < ApplicationRecord | |
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 WelcomeController < ApplicationController | |
def index | |
# @connection = ActiveRecord::Base.establish_connection( | |
# :adapter => "postgresql", | |
# :host => "****", | |
# :database => "*****", | |
# :username => "****", | |
# :password => "*****" | |
# ) | |
# | |
# sql = "SELECT project_name FROM project" | |
# @result = @connection.connection.execute(sql); | |
project = Project.all | |
@result = project | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment