Coder Social home page Coder Social logo

nku's Introduction

CIT 394 Syllabus

Objective

  • Develop web applications with Ruby on Rails
  • Understand the basic architecture of modern web applications
  • Learn the values and principles that form the basis of Ruby and Rails development

Assignments

See Classes

Each week, we'll publish the solution to the previous weeks assignment on the nku-rails Github Repo

There's also a publicly availible Demo app for viewing the completed assignments

Evaluation Criteria

We're not talking attendance, but we might give a pop quiz to strike fear into your heart. The majority of your grade will come from class assignments and projects.

Grading Criteria:

  • 60% - The assignment meets the specs provided
  • 10% - Your communication and problem solving to get the assignment done and learn the material
    • Github issues
    • In class participation
    • Helping other classmates on a Github issue
  • 30% - Our subjective assessment of how maintainable your code is:
    • Does it follow the conventions that we've discussed in class?
    • Is the code in the right place?
    • Are there tests that would help someone understand and work on your project?
    • Can we easily follow your process through git history?
  • Possible in-class quizzes will be added in
  • If you do a great job helping someone on a Github issue we're likely to give you a bonus

Troubleshooting

If you get stuck on an assignment, add a Github Issue to the NKU class repo. Please browse other issues before creating a new one in case someone has already asked your question. Also, please feel free to comment on any open issues.

nku's People

Contributors

mitchlloyd avatar rockwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nku's Issues

5.7 and 5.8 syntax error in guide.

After adding
post GET /posts/:id(.:format) posts#show
posts GET /posts(.:format) posts #index

from steps 5.7 and 5.8 into my routes.rb file which I initially typed by hand and later copy and pasted because they did not work I am no unable to launch my rails server and preview pages after my box went idle.
Below is my terminal log. If anyone is up and can provide some insight it would be appreciated.

    action@atkinsonj3-70439:~/nku-rails(master*)$ rails server                                                                                                              
    => Booting WEBrick                                                                                                                                                      
    => Rails 4.0.2 application starting in development on http://0.0.0.0:3000                                                                                               
    => Run `rails server -h` for more startup options                                                                                                                       
    => Ctrl-C to shutdown server                                                                                                                                            
    Exiting                                                                                                                                                                 
    /home/action/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load': 
    /home/action/nku-rails/config/routes.rb:5: syntax error, unexpected ':', expecting keyword_end (SyntaxError)                                                                                                                  
    post GET    /posts/:id(.:format)      posts#show                                                                                                                    
                        ^                                                                                                                                               
    /home/action/nku-rails/config/routes.rb:16: syntax error, unexpected ':', expecting keyword_end                                                                  
    #   get 'products/:id' => 'catalog#view'                                                                                                                              
                     ^                                                                                     
    /home/action/nku-rails/config/routes.rb:16: syntax error, unexpected tIDENTIFIER, expecting keyword_end                                                                
    #   get 'products/:id' => 'catalog#view'                                                                                  
##Update

there seems to be a problem with :id across my entire environment though I am unsure why as the rake routes come back exactly as it does in the getting started

action@atkinsonj3-70439:~/nku-rails(master*)$ rake routes
   Prefix Verb   URI Pattern               Controller#Action                                                                                                             
    posts GET    /posts(.:format)          posts#index                                                                                                                   
          POST   /posts(.:format)          posts#create                                                                                                                  
 new_post GET    /posts/new(.:format)      posts#new                                                                                                                     
edit_post GET    /posts/:id/edit(.:format) posts#edit                                                                                                                    
     post GET    /posts/:id(.:format)      posts#show                                                                                                                    
          PATCH  /posts/:id(.:format)      posts#update                                                                                                                  
          PUT    /posts/:id(.:format)      posts#update                                                                                                                  
          DELETE /posts/:id(.:format)      posts#destroy                                                                                                                 
     root GET    /                         welcome#index
## Update 2

I have progressed forward anyways read some of the other documents available and my current routes.rb looks as it does below but the same problem persist, and I have back worked most the steps in the assignment and have yet to narrow the problem.

NkuRails::Application.routes.draw do
  #get "welcome/index"
    resources :posts #Adds REST resources
    GET    /posts/:id(.:format)      posts #show
    GET    /posts/:id(.:format)      posts #index
    DELETE /posts/:id(.:format)      posts#destroy
    root to: 'welcome#index' #Rails Root location to start looking from
end

Update 3

I have been able to proceeded some to step 6.4 but cannot go past it due to more errors. I will try and work on this some at work tomorrow and keep checking back here
Current error message:

action@atkinsonj3-70439:~/nku-rails(master)$ rails generate controller Comments                                                                                          
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load': /home/action/nku-rails/config/routes.rb:64: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError) 

Tutorial: 5.7 Showing Posts

I figured I would post this in hopes of preventing other people from wanting to strangle their computers (because that's possible, didn't you know?).

As I was going through the tutorial, I reached section 5.7, where I quickly became confused. Here's where I mean:
5 7 showing posts

I googled for a few minutes and came up with a more concise version of the section, here: http://edgeguides.rubyonrails.org/getting_started.html#showing-posts.

What was holding me up was that I didn't know what "post GET /posts/:id(.:format) posts#show" was, if I was supposed to put it somewhere, or if so, where I was supposed to put it. But it turns out, it's just what you're supposed to see when you run the command "rake routes." So if you see that, then everything's working right.

git commit

I finished the tutorial successfully but I am confused on what the git commit or anything to do with git actually does. I never used git before outside the git tutorial we did in class but I still don't understand what I am supposed to do with the git commit command? Is git commit how I save my work? I still have my nitrous window up just in case.

Sign in on sign up?

So, everything is working fine, but when I sign up, I'm not sure how to approach creating a session after that form is completed. Any ideas?

SyntaxError in Posts#new

So, in trying to make my users/new work, I somehow messed up my posts/new. I'm terrible confused because I receive this error.
I've gone through the file more times than I can count and I have the appropriate number of ends.

Thanks

Trying to use: http://swiedaa1-72810.use1.nitrousbox.com/posts/new

screenshot 2014-01-31 07 48 14

Code for _form.html.erb:
<% link_to 'Edit', edit_post_path(@post) %>

`<% if @post.errors.any? %>

<%= pluralize(@post.errors.count, "error") %> prohibited this student from being added:

    <% @post.errors.full_messages.each do |msg| %>
  • <%= msg %>
  • <% end %>
<% end %>` `

<%= f.label :name %>
<%= f.text_field :name %>

` `

<%= f.label :nickname %>
<%= f.text_field :nickname %>

` `

<%= f.label :email %>
<%= f.text_field :email %>

` `

<%= f.label :image %>
<%= f.text_area :image %>

` `

<%= f.submit %>

<% end %>`

issue with deleting a user?

Whenever I try to delete a user, the application_controller complains it can't find my user. Is it because I am deleting them, and if so, how do I mitigate that?

How to initialize variable for link_to

error

I have a login.html.erb in the views/students folder not sure why it works for 'new' and not the 'login'.

I also defined the login method in the controller but didn't help. so I am missing something still.

In general confusion.

I am a bit turned around with what exactly we should be doing. I had all of my pages working just fine with the updated post controller, html pages, etc. Well, I started trying to add in the code from the slides for the user_controller, etc but now I am curious as to if I am over complicating things.
I am currently receiving a NameError and thats fine. I'm not worried abotu that. Thats simply because I started trying to add in the user controller/method/etc.
Current problems broken down:

  • Should we have a post controller AND a user controller?
  • I cant for the life of me figure out how to reroute my submit form to the home page. I'm not sure if the submit page I have is acceptable. It shows all of the updated/submitted information and informs the student that everything has been submitted successfully. Then I have a "home page" link where it brings you to the list (one extra step than the directions call for)
  • I havent even begun the Gravatar portion since I havent pade it that far. Suggestions help.
  • Will the teacher need their own page? Like, Do they have to sign in to Bueller to see the student information or should they see the same home page the students see?

Rails repo: https://github.com/swiedaa1/nku-rails

Tutorial - 5.7: Showing Posts

Either I screwed up something earlier in the code or I'm just missing something because I keep hitting wall after wall. I get this error message when I go to save a post:

capture 3

Any help would be greatly appreciated.

Can't start rails server

When I try and start my rails server I get an error message. I think the routes.rb is the problem so i posted the stack trace and my routes.rb below.

$ rails server
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/action/nku-rails/config/routes.rb:1:in <top (required)>': uninitialized constant Ruby (NameError) from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:inblock in load_paths'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in each' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:inload_paths'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in reload!' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:inblock in updater'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in call' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:inexecute'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in updater' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:inexecute_if_updated'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in block in <module:Finisher>' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:30:ininstance_exec'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:30:in run' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:55:inblock in run_initializers'
from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in block in tsort_each' from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:inblock (2 levels) in each_strongly_connected_component'
from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in each_strongly_connected_component_from' from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:inblock in each_strongly_connected_component'
from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in each' from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:ineach_strongly_connected_component'
from /home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in tsort_each' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:54:inrun_initializers'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:215:in initialize!' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from /home/action/nku-rails/config/environment.rb:5:in <top (required)>' from /home/action/nku-rails/config.ru:3:inrequire'
from /home/action/nku-rails/config.ru:3:in block in <main>' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:ininstance_eval'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in initialize' from /home/action/nku-rails/config.ru:innew'
from /home/action/nku-rails/config.ru:in <main>' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:ineval'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in new_from_string' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:40:inparse_file'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:277:in build_app_and_options_from_config' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:199:inapp'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in app' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:314:inwrapped_app'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in start' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:76:inblock in <top (required)>'
from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:71:in tap' from /home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:71:in<top (required)>'
from bin/rails:4:in require' from bin/rails:4:in

'

RAILS.RB

Ruby::Application.routes.draw do

get "welcome/index"

resources :posts do
resources :comments
end

root 'welcome#index'

end

Flash not working

I am not sure how to create the flash message. I tried following the guide as best I can.

In my users_controller:

def create
  @user = User.new(user_params)
  @user.save
  flash[:notice] = "student was successfully created."
  redirect_to @user, notice: "student was successfully created."
end

and in my applications layout: application.html.erb

<% flash.each do |name, msg| -%>
  <%= content_tag :div, msg, class: name %>
<% end -%>

This does display a message when a student is created however, it is not in a alert message box it just displays this text at the bottom of the page.

image

No route matches [PATCH] "/students.4"

Anyone run into this error before? I am trying to add editing functionality but it looks like it sends me to the wrong place. I had it wired up wrong before so "Submit" just created a new student with the changes, now I get this.

Any ideas?

Quick Issue, not sure of syntax for create in StudentsController

Here's my code:

screen shot 2014-02-06 at 4 29 45 pm

It seems that no matter what I change these to I can't get it to except the conditions in the if statement, it always takes the else. I've gotten it so that I no longer get any errors of any kind but it still fails no matter what. The documentation that I can find online for rails seems to be more about creating login stuff rather than creating the new users with this password_digest stuff so I keep getting confused using the wrong code in the wrong places...

Very simple problem, cant figure out!

I am trying to create a sign in page but I am not sure as to why I am getting this error?! It seems so simple and I have been trying everything for a long time now.

image

Trying rake routes does not show the sign in page but I'm not sure how to proceed and this is preventing me from really doing much else for this assignment.

image

As you can see below,
I have created the html sign in page.
I defined sign in page in the controller file.

image

image

Flash?

Has anyone got theirs to do anything? I figure we should do something like this:

if @student.update(params[:student].permit(:name, :nickname, :email, :image))
      redirect_to students_path, flash: "You have successfully edited your account."

but that doesn't seem to do anything. Any ideas?

ActionController: Exception

I've just been powering through this assignment because I'm pretty sure I have no idea what I'm doing but some things seem to be working which is really surprising but I'll take what I can get and not complain. Anyways, my error seems to be this:

screen shot 2014-01-29 at 2 30 12 pm

...hopefully that shows up as a picture.

I have the student list working, and was able to add students to it and have them appear on the list. But now I can't add students for some reason(I'm trying to navigate to the add students screen by just adding /new to the end of my URL since I can't figure out how to create a link to the page), and I'm not exactly sure why. Comparing this code to the tutorial code makes me feel as though it should work, the only difference is that I'm permitting 4 parameters instead of just the two.

Other than that, I'm not exactly sure how to make the link appear to add a new student on the index/student_list screen. The tutorial code didn't seem to have anything that was obviously the code for that, which is leaving me stumped... but I guess that's another issue entirely...

Assignment 1

For Assignment 1, do we wan't to just change the git repo to point from the one provided here - nku/rails - to our own?

What I did is I deleted the .git file from the /nku-rails directory and then did another 'git init' to create a connection to my own github repo, which I created first in github. Now that I have it set up I push to csc439-assignment1 (my repo) instead of the initial one (that I don't have access to push to).

Is that what we are supposed to do? Also, if this is the wrong place for this, please let me know.

Thanks,
Adam

Route issue, except I'm using the users_path

selection_006

I get this above routing error after I click "create new user" and submit the form. Does anyone have any ideas? Below is my routes.rb file and my controller. I tried checking the "users_path" and found once case of "user_path" but I fixed it to the plural already and I still get the error.

Routes.rb

RailsNku2::Application.routes.draw do
get "welcome/index"

The priority is based upon order of creation: first created -> highest priority.

See how all your routes lay out with "rake routes".

You can have the root of your site routed with "root"

#resources :posts do

resources :comments

#end
resources :sessions
resources :users

root 'welcome#index'

end

Users Controller

class UsersController < ApplicationController

def new
@user = User.new
end

def create
@user = User.new(params[:user])
if @user.save
redirect_to users_path, notice: "Successfully created #{@user.name}"
else
render "new"
end
end

def index
@users = User.all
end

def user_params
params.require(:user).permit(:email, :password, :name, :nickname, :image)
end

end

Adding comment not working anymore

Adding comments used to work but now after I finished the tutorial everything works except for adding new comments. I triple checked the syntax and I believe it might of happened in the re-factoring section of the tutorial because I was able to add comments before that. Here is my error:

image

ArgumentError in Posts#new.html.erb

For the life of me I cannot figure out what is failing to be defined and causing this issue. Any help would be awesome.

ArgumentError in Posts#new.html.erb

Showing /home/action/nku-rails/app/views/posts/_form.html.erb where line #1 raised:

First argument in form cannot contain nil or be empty

Extracted source (around line #1):

<%= form_for @post do |f| %>
<% if @post.errors.any? %>

<%= pluralize(@post.errors.count, "error") %> prohibited

<%= form_for @post do |f| %>
<% if @post.errors.any? %>

<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:

    <% @post.errors.full_messages.each do |msg| %>
  • <%= msg %>
  • <% end %>

<% end %>

<%= f.label :title %>
<%= f.text_field :title %>

<%= f.label :text %>
<%= f.text_area :text %>

<%= f.submit %>

<% end %>

class PostsController < ApplicationController
http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show]
def new
@post = Post.new
end
def create
@post = Post.new(params[:post].permit(:title, :text))
if @post.save
redirect_to @post
else
render 'new'
end
end
def show
@post = Post.find(params[:id])
end
def index
@post = Post.all
end
def edit
@post = Post.find(params[:id])
end
def update
@post = Post.find(params[:id])

if @post.update(params[:post].permit(:title, :text))
  redirect_to @post
else
  render 'edit'
end

end
def destroy
@post = Post.find(params[:id])
@post.destroy
redirect_to posts_path
end
private
def post_params
params.require(:post).permit(:title, :content)
end
end

issue with Index

So, I am trying to add authentication but running into an issue where I can't see the index page without being prompted for authentication. I added this to my student model:

has_secure_password

and this to my controller:

http_basic_authenticate_with name: "student", password: "password", except[:index]

Shouldn't the except keep me from being prompted?

New Issue 'No Route Matches Post'

I'm pretty sure this is something super simple that I'm missing but I can't seem to pinpoint exactly what after trying a bunch of different things. Here's my error:

screen shot 2014-01-30 at 4 55 23 pm

So this occurs after the user enters their info and hits the submit button. Here's the code I've been using for my create method:

screen shot 2014-01-30 at 4 56 09 pm

From googling I think I've determined what the problem isn't. It's not that 'StudentsController' is named 'StudentController'. Adding the code in routes.rb: post "students/create" changes nothing. Adding: post "students/new" just takes them back to the form they just filled out, but doesn't post it. Adding: post "student/index" makes everything worse.

I don't really know what else to try but I have been just changing tiny bits of code to try to make it work but nothing seems to change...

TypeError in Students#index no implicit conversion of nil into String

I've tried tweaking every file I could think of, I'm not really sure what the problem is, Any help would be appreciated.

no implicit conversion of nil into String
Extracted source (around line #14): #Name: 'student.Name

 <tr>
   <td><br/>
      <%= image_tag gravitar_url(student), :size => "48x48" %><br/>
      <%= 'Name: '+student.Name %><br/>
      <%= 'Nickname: '+student.Nickname %><br/>
      <%= 'Email: '+student.Email %><br/>
   <%= link_to 'Edit', edit_student_path(student) %>

Issue with parameters

selection_005

I don't understand why it would say this. Inside my view that it is referencing I have this code:

New User

<%= form_for @user do |f| %>

<%= f.label :name %>
<%= f.text_field :name %>

<%= f.label :nickname %>
<%= f.text_field :nickname %>

<%= f.label :email %>
<%= f.text_field :email %>

<%= f.label :image %>
<%= f.text_area :image %>

<%= f.submit %>

<% end %>

<%= link_to 'Back', users_path %>

Tutorial 5.2: The First Form

The form works up until I add "url: posts_path" to new.html.erb, then I get this error
capture
I may have rooted my program to the wrong location in routes.rb, I have it pointing to "root 'posts#new'"

Models for User/Student

Are we creating a new model for the Users, or are we trying to use the Student model to accomplish our sign in/sign off functionality?

No Method error in welcome#index

I have completed the tutorial all the way though check my syntax over a few times and cannot find what is giving me this no method error on my index page.

noomethod

I am going down through the tutorial again checking everything over, if any one has suggestions I'll take them.

the flash has no color?

I guess this isn't that big of a deal, but my flash messages don't have any color to them? I have tried success, error, and notice in Firefox and Chrome.

Here is the code:
redirect_to students_path
flash[:success] = "Added Student!"

I have also tried this:
redirect_to students_path, :flash => { :notice => 'Added Student!' }

Same thing happens I see the message but it has no color. Anyone know why? Thanks.

2 errors URL Generation error in student/index, unknown attribute in StudentController

Most recent commit is accessible here https://github.com/Spartan-196/nku-rails
Rails host: http://atkinsonj3-72805.use1.nitrousbox.com/students

I am receiving a URL generation error when trying to go to my student index page, and i am not as of to why it thinks I have it set to require an ID when navigating there in general as its not needed until after login

urlgeneration_error
most recent student index page is here
https://github.com/Spartan-196/nku-rails/blob/master/app/views/students/index.html.erb

Second:

After manually navigating to http://atkinsonj3-72805.use1.nitrousbox.com/students/new and making a new user anyways trying to make the session ID kicks back saying its got an invalid attribute.
unknown_attrib

ITs complaining about this line

@student = Student.new(student_params)

student parms is defined by

private
  def student_params
    params.require(:student).permit(:name, :nickname, :email, :password, :password_confirm, :image)
  end

This is the form being submitted:

<p>
      <%= f.label :name %><br> <!--Form Title Text -->
      <%= f.text_field :name %><!--Form Text field (single line) for user-->
  </p>

  <p>
      <%= f.label :nickname %><br> <!--Form Text Box Title  -->
      <%= f.text_field :nickname %><!--Form Expandable Textbox for User -->
  </p>
  <p>
    <%= f.label :email %> <br>
    <%= f.text_field :email%>
  </p>
    <p>
    <%= f.label :password %><br>
    <%= f.password_field :password %>
  </p>

  <p>
    <%= f.label :password_confirm %><br>
    <%= f.password_field :password_confirm %>
  </p>
  <p>
    <%=f.label :image %> <br>
    <%=f.text_field :image %>
  </p>
  <p class="button">
    <%= f.submit %> <!-- submit button-->
  </p>

it most definitely is passing password as also shown in the screen capture as it filters it and the confirmation one out

NoMethodError in PostsController#create

So, I'm trying to add additional methods to make the Name, Nickname, Email, and Image URL fields. I've gone through all of my files to make sure where it used to just say (:title, :text) have been edited to include title1, title2, title3, and text. I've edited the post controller, the edit, form, and show. I've gone through the directions several times and I finally have additional text boxes, I cant click the post button without receiving the error.

I wasnt trying to get the code perfect yet, please excuse the formatting for titles rather than calling them name, nickname, etc yet. I figured I could make things pretty once I got to the bottom of this darn error.

Page link: http://swiedaa1-72810.use1.nitrousbox.com/posts

screenshot 2014-01-28 14 29 03

Can't connect to my Nitrous.IO box

It will keep sitting there "connecting". Sometimes I also get a message saying "ssh: can't resolve user1.nitrousbox.com". I was able to connect before. Any thoughts?

ActiveRecord::PendingMigrationError

I CD to nku-rails directory and wanted to ensure my new box was working correctly, so I entered rails server, the server started up successfully and when I went to preview (assignment 1) I now get the following error.
I did some research and found that I am supposed to run the command that it tells me ( bin/rake db:migrate RAILS_ENV=development ), if that does not work ( which it failed ) with the following console message:

CreateComments: migrating =================================================
-- create_table(:comments)
-> 0.0116s
-- add_index(:comments, :post_id)
rake aborted!

I then read that I need to do a server restart, so I tried to reboot the server but I do not have root access to this box. Can a root please restart it for me if that's the case?

rubyerror

Need to recover

So, I wanted to try to play around with bootstrap and I apparently caused a horrible horrible destruction of well everything on nitrous. I had (for once) intelligently pushed to github prior. So, I have tried to clone off github off my account to no avail. Suggestions?

Updating student models

So, I found out that I can solve some issues by defining methods off of the model, so Student.rb, but now I am getting weird errors like this:

image

Anyone else have the same issue?

NoMethodError

Not sure what I am doing wrong. I have looked over everything three times. Anyone have any ideas?

screenshot - 01212014 - 06 58 01 pm

Routes issue here

Hey guys,

I'm running into a problem when I moved the app over to a new controller. It is now a "student_controller", but when I go to http://finkec2-72813.use1.nitrousbox.com/student/new I get the following error:

capture2

I'm not sure how to add it but I do know the problem is students_path doesn't exist according to rake routes:

capture

Any ideas what I've done wrong?

NameError in #EntriesIndex

So I'm receiving the error below and I'm not quite sure as to why.
image

Here's my "index.html.erb" code...

<h1>Student Directory</h1>
<%= link_to 'New Student Entry', new_entry_path %>
<table>
  <tr>
    <th>First Name</th>
    <th>Last Name</th>
    <th>E-mail Address</th>
    <th>Gravatar Image</th>
  </tr>

  <% @entries.each do |e| %>
  <tr>
    <td><%= e.first_name %></td>
    <td><%= e.last_name %></td>
    <td><%= e.email_address %></td>
    <td><%= e.gravatarimage_image_url %></td>
    <td><%= link_to 'Show', @entry %></td>
    <td><%= link_to 'Edit', edit_entry_path(entry) %></td>

  </tr>
  <% end %>
</table>

Also, when I can see all of the entries, the "show" link for each one is just redirecting back to the whole index of entries and I'm not sure why. Here's my rake routes output...

Prefix Verb   URI Pattern                 Controller#Action                                                                                                                                                                   
home_index GET    /home/index(.:format)       home#index                                                                                                                                                                          
   entries GET    /entries(.:format)          entries#index                                                                                                                                                                       
           POST   /entries(.:format)          entries#create                                                                                                                                                                      
 new_entry GET    /entries/new(.:format)      entries#new                                                                                                                                                                         
edit_entry GET    /entries/:id/edit(.:format) entries#edit                                                                                                                                                                        
     entry GET    /entries/:id(.:format)      entries#show                                                                                                                                                                        
           PATCH  /entries/:id(.:format)      entries#update                                                                                                                                                                      
           PUT    /entries/:id(.:format)      entries#update                                                                                                                                                                      
           DELETE /entries/:id(.:format)      entries#destroy                                                                                                                                                                     
      root GET    /                           home#index     

Any help would certainly be appreciated. Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.