Git Product home page Git Product logo

full-stack-project's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

full-stack-project's Issues

READ THIS FIRST

TLDR; We expect you to ask good questions. What is good? Read on.



Trevoke/asking-questions.md

Muad'Dib learned rapidly because his first training was in how to learn. And the first lesson of all was the basic trust that he could learn. It's shocking to find how many people do not believe they can learn, and how many more believe learning to be difficult. Muad'Dib knew that every experience carries its lesson.

– Dune, Frank Herbert

The value of questions

Why this text

This text addresses a fundamental point: the critical exploration of the self in the context of the critical exploration of the world. This text aims to shed some light on the matter by expanding on a simple idea: the process that leads to asking a question.

Why ask a question

When my father was a teenager, in the late fifties, his science teacher used to ask the following question:

If we had a machine that could give you the answer to any question you had, would there be any point in doing science?

And here is the answer this same teacher gave:

Yes! Because the point of science is to ask questions. The answers are just the work.

This is a very important idea. Sure, science put dogs and people in space, but the only reason this became possible was because people asked the questions that led us to this result.

What comprises a question

Part 1: asking the question

In order to ask the question, you have to evaluate the situation and understand what is not clear sufficiently to word it. This exercise is very valuable, as it trains you to recognize situations and problems. Being mindful of what you do as you do it is very helpful, as it shortens the evaluation time. It is usually equally important to be mindful of why you do what you do, as knowing the goal can help frame your question.

Part 2: getting the answer

Knowing the answer means at the very least that now the question is out of the way. With luck, it was the correct question, and now we can proceed to other interesting ideas and problems. Otherwise, one must endeavor to find another, better question, closer to what the actual problem is.

Where we stand

Being a developer means crystallizing a vague problem that people have into a concrete set of behaviors which distil down to a solution. Being a developer means being able to think, connecting ideas and questions into patterns old and new. Learning to code is just learning to put characters next to each other. Eventually, even monkeys can write Shakespeare. Typing the code is irrelevant; writing code does not a developer make. Code is just the byproduct of the mental process that leads you to the choices of behaviors you are implementing. What you are truly learning to do is learning to ask questions – and work your way to the answer. Every single time you don't practice asking a question, you are robbing yourself of what you came here to do.

The work of asking the right question is not optional. You have to do it, because it will be your constant companion in the future.

Unfortunately, this is not a History or Geography course. The topics we discuss and teach aren't simple matters of memorization, and the questions are rarely as simple as "I forget where Zimbabwe is". They usually are more like "I'm trying to get this particular set of data out of my storage layer and transform it into such a way that it is available for presentation with a simple each loop when I go to this URL, but SOMETHING IS GOING WRONG"

Sometimes, saying "help" means "I'm really confused by what is happening, I am at my wits' end and I need someone to help me re-center so I can continue doing the work"

When that's the case, please explain that out in the way which is appropriate for your current situation. This will help us understand the context, the words, and the question.

The human aspect of questions

When you want someone to answer a question, a few things need to happen:

  • They have to understand your context
  • They have to understand your words
  • It has to be the right question

Let's go through a few examples and examine how they fit the criteria:

"help, issues running a ruby file"

The context is clear: we're trying to run a Ruby file. The words are clear - a file isn't working. The question is unclear, because there are many, many possible reasons for a Ruby file to not work.

"help with homework"

The context is unclear. Which homework? The words are clear - it's got to do with homework. The question ... Well, it's not a question.

"help cant run server on p80"

The context is unclear: why can you not run the server? The words are clear: we want to run a server on port 80 and we're unable to. The question is unclear: do we want to know how to do it or why it doesn't work?

"help Bookmark App -- Refactoring Timestamp code"

The context is clear: the timestamp code of the Bookmark application. The words are clear: we want to refactor existing code. The question is unclear, but that's probably because how to refactor is usually a nebulous question.

"help understanding where this logo is supposed to go in the "brook and lyn" assignment"

The context is clear: the "book and lyn" assignment. The words are clear, there's a question about the design. The question is unclear - "this logo" is pretty dependent on what the person asking the question is thinking about at the time.

"help "Remote Host Identification has changed""

This is an interesting example, because it is simply an error message. However, here's the thing:
The context is clear. This error message means one thing and one thing only, and has a particular context attached with it. The words are inexistent. The question is also inexistent, but we assume whoever posted this got stumped.

"help with SyntaxError in circle.rb - line 4 is empty and I can't figure out what's wrong"

The context is clear - the file circle.rb has a SyntaxError on line 4. The words indicate that the person has read the error message and tried to figure it out. The question is "I'm out of ideas, I don't know what's wrong".

"help"

I'm sure by now you can see where this fails to meet the standard.


Other resources



adambray/asking_for_help.md


How to Ask Questions on Github

In order to receive help on an issue you are having during your development process you must submit a Github Issue for your project. Below is a guide for the information that must be included when submitting an issue. It is expected that you will try to debug/solve an issue prior to submitting a request for help on Github.

Context

When submitting an issue provide some context as to what the problem is. This includes but is not limited to:

  • What User Story you are currently working on
  • What you are trying to do
  • Detailed description of the bug or error
  • Relevant code/files/errors, screenshots
  • Gems and/or other technologies being used

What have you tried?

Give information about what you have done to solve the problem. Including but not limited to:

  • Documentation you have looked at
  • Steps you have taken to solve the problem
  • Resources you have used

Question

What would you like help with specifically?

For an example: how to ask questions

Odd behavior with delete

I was having trouble with a delete function in a controller so I stripped everything out of it:

def destroy
end

and it still reports and error (in server window), I'm confused about where the second query is coming from:
Started DELETE "/messages/1" for ::1 at 2015-11-10 13:45:25 -0500
Processing by MessagesController#destroy as HTML
Parameters: {"id"=>"1"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."token" = $1 LIMIT 1 [["token", "81d3f9418f2c65c04055f50239265398"]]
Message Load (0.3ms) SELECT "messages".* FROM "messages" WHERE "messages"."id" = $1 LIMIT 1 [["id", 1]]
Completed 404 Not Found in 3ms (Views: 0.9ms | ActiveRecord: 0.6ms)

Curious how to test my join table

Modeled it after the many through movies controller to set my join table controller but curious

class BeersController < OpenReadController
before_action :set_beer, only: [:update, :destroy]

  # GET /beers
  def index
    @beer_choices = Location.beer_choices

    render json: @beer_choices
  end

  # GET /beers/1
  def show
    @beer_choices = Location.find(params[:id])

    render json: @beer_choices
  end

  # POST /beers
  def create
    @beer = current_user.beers_choices.new(beer_choices_params)
    @beer_choices.save

    if @beer_choices.save
      render json: @beer_choices, status: :created, location: @beer_choices
    else
      render json: @beer_choices.errors, status: :unprocessable_entity
    end
  end

  # PATCH /beers/1
  def update
    if @beer_choices.update(beer_choices_params)
      head :no_content
    else
      render json: @beer_choices.errors, status: :unprocessable_entity
    end
  end

  # DELETE /beers/1
  def destroy
    @beer_choices.destroy

    head :no_content
  end

  def set_beer_choices
    @beer_choices = current_user.location.find(params[:id])
  end

  def beer_params
    params.require(:beer_choices).permit(:location_id, :beer_id)
  end

  private :set_beer_choices, :beer_params_choices
end

end

having trouble deleting collections

def destroy
@messages = User.find(params[:id]).messages
@messages.destroy

head :no_content

end

not sure where to go from here, @messages = User.find(params[:id]).messages gets the messages I want to destroy

Trying to use a Create Method via authentication on a table that is 2 join tables away from User

Current Data structure:
User (has many) --> Weekly Menus (has many Recipes through Meals) --> Meals (belongs to weekly menus and recipes) --> Recipes (has many meals)

When logged in as User, when I try to create a Recipe via POST, I get a an error message that says undefined method "recipes" for User. I'm pretty sure that is because I have not set any "has_many, through" associations for Users and Recipes. I am not even sure that association is even necessary via how I am calling my data, so I'm wondering if there is a way around it. I do not want to allow recipe creation without authentication.

Heroku issue and counter cache question

I haven't been able to get my backend to work in heroku. most recently the message is that the page doesn't exist. I've gone through the readme steps three times on my own, made sure all my branches are up to date, and tried to trouble-shoot from console error messages, though I am not getting any this time.
Also, I'm trying to figure out if using a counter in my db will be helpful for my program, but I'm a little unclear from the rails api documentation and other sources that I have looked at, if it is necessary or if I am using it correctly.

Thanks!

Trying to run index controller method tied to user_id

This is the code in my WeeklyMenusController < OpenReadController:

  def index
    @weeklymenus = WeeklyMenu.where(user_id: current_user)

    render json: @weeklymenus
  end

My current_user has an ID of 5, and I'm trying to get my GET request to return all WeeklyMenus associated with User_ID 5.

Query does not return any ActiveRecord objects with user_id: 5.

Still can't figure out what is wrong with my data structure for a create ajax request

Still getting the following error:



Started OPTIONS "/words" for ::1 at 2015-11-11 09:42:15 -0500


Started POST "/words" for ::1 at 2015-11-11 09:43:41 -0500
Processing by WordsController#create as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."token" = $1 LIMIT 1  [["token", "a450ec1665e8e449bcd43e3e4c10cdbd"]]
Completed 400 Bad Request in 1ms (ActiveRecord: 0.3ms)

ActionController::ParameterMissing (param is missing or the value is empty: word):
  app/controllers/words_controller.rb:42:in `word_params'
  app/controllers/words_controller.rb:17:in `create'


  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (3.5ms)
  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.8ms)
  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.3ms)
  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (45.2ms)


I cannot access my tables through Curl

It's not even hitting my database. Trying to use the curl commands in the README for the api. Grabbing a token from the server and plugging it in.

My controllers are inheriting from OpenReadController and at least Locations worked when it was inheriting from ApplicationController

Guidance

Would like to just go over my data model and make sure I'm heading in the right direction before I delve to deep.

heroku deployment troubleshooting

I'm trying to deploy my app on heroku, and I'm getting a "The page you were looking for doesn't exist." error. I fixed some of the problem (or at least created more different problem!) by going through the deployment repo again, but I'm still getting errors, and I'm not sure what they mean. It seems like it is requesting things from the path "/", and I'm not surprised that it's not getting what it wants from that path, but I'm not sure how or what to change.
The logs say:
2015-11-10T19:04:49.634473+00:00 heroku[router]: at=info method=GET path="/" host=mighty-shelf-9974.herokuapp.com request_id=d7e7f4cd-9cd1-4068-a007-3763688399eb fwd="157.130.220.250" dyno=web.1 connect=14ms service=62ms status=404 bytes=1744
2015-11-10T19:25:06.061120+00:00 heroku[router]: at=info method=GET path="/" host=mighty-shelf-9974.herokuapp.com request_id=7c53cf0f-a5aa-45a9-9682-12c999a2dc94 fwd="157.130.220.250" dyno=web.1 connect=1ms service=150ms status=404 bytes=1744
2015-11-10T19:25:06.257192+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mighty-shelf-9974.herokuapp.com request_id=fb12cd91-8d66-469d-97d9-6f154e09fcc5 fwd="157.130.220.250" dyno=web.1 connect=16ms service=4ms status=304 bytes=48

Parameters error when creating property from browser/javascript. Works with curl. Details below. Cannot resolve.

Error when PropertiesController invoked from Browser

Started POST "/properties" for ::1 at 2015-11-11 09:55:22 -0500
Processing by PropertiesController#create as HTML
Parameters: {"{"property":{"no":"12","street":"Fuller Street","city":"Sheldon","state":"NH","zip":"34876","house_mgmt_co":"Holsten Holdings","manager":"Matt Savrest","user_id":3}}"=>nil}
User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."token" = $1 LIMIT 1 [["token", "4cc8af9ed51fe85dd117c0d615a2621a"]]
Completed 400 Bad Request in 5ms (ActiveRecord: 1.5ms)

ActionController::ParameterMissing (param is missing or the value is empty: property):
app/controllers/properties_controller.rb:48:in property_params' app/controllers/properties_controller.rb:18:increate'

Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (3.5ms)
Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.8ms)
Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.9ms)
Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (43.6ms)

Successful completion when add property invoked via curl
Started POST "/properties" for ::1 at 2015-11-11 10:07:22 -0500
Processing by PropertiesController#create as /
Parameters: {"property"=>{"no"=>"56", "street"=>"Weston Drive", "city"=>"Ashton", "state"=>"KY"}}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."token" = $1 LIMIT 1 ["token", "4cc8af9ed51fe85dd117c0d615a2621a"] BEGIN
SQL (1.0ms) INSERT INTO "properties" ("no", "street", "city", "state", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" ["no", "56"], ["street", "Weston Drive"], ["city", "Ashton"], ["state", "KY"], ["user_id", 3], ["created_at", "2015-11-11 15:07:22.955276"], ["updated_at", "2015-11-11 15:07:22.955276"] COMMIT
Completed 201 Created in 17ms (Views: 1.8ms | ActiveRecord: 2.4ms)

Need help getting my front end to talk to my backend

So I've been able to to test the user registration/login and routes in postman, but my db isn't updating when I register from the front end. I added an alert code to my main js file to make sure they are linked and working, and I get the alert message when I log in, and I have checked the web console for errors and don't have any.

Can I get someone to look at my api.js file?

Thanks!

having trouble with my login ajax request

At the end of my login.on() method I have a console.log("You logged in") and $('.login-block').hide(); to display that I did, in fact, log in. I put debuggers in between every line of my code to see how each line is working. Going through each line piecemeal, everything seems to be working. However, once I exit the .on() method the website seems to refresh and the console doesn't display anything and the html isn't hidden. No error messages are being displayed either.

My rails server is giving me an error and trouble-shooting on my own hasn't proven effective

Here's the message: uninitialized constant ActionController::API
I'm trying to make sure that all is well with users controller/routes that I copied from Antony's api.

So far, I've google searched the error message
read through some stack overflow posts
I've checked to make sure that classes match controller names
checked with classmates, had them look at my code in case I missed something

So my question is, how do I initialize constant ActionController::API?

Can't get my create or update to work

class ItemsController < ApplicationController
  #GET /items
  def index
    #show all iems
    @items = Collection.find_by_id(params[:collection_id]).items.all

    render json: @items
  end

  #GET /items/1
  def show
    #show a particular item
    @item = Collection.find_by_id(params[:collection_id]).items.find(params[:id])

    render json: @item
  end

  #POST /items
  def create
    @item = Collection.find_by_id(params[:collection_id]).items.new(item_params)

    if @item.save
      render json: @item, status: :created,
        location: @item
    else
      render json: @item.errors, status: :unprocessable_entity
    end
  end

  #PATCH /items/1
  def update
    if @item.update(item_params)
      head :no_content
    else
      render json: @item.errors, status: :unprocessable_entity
    end
  end


  #DELETE items/1
  def destroy
    @item.destroy

    head :no_content
  end

  def set_item
    #look up items owned by current user
    # @item = Collection.find_by_id(params[:collection_id]).items.find(params[:id])
    @item = current_user.items.find(params[:id])
  end

  def item_params
    params.require(:item).permit(:name, :photo_url, :description)
  end

  private :set_item, :item_params
end

I have items resources nested within collections resources.
A collection has many items.
Item belongs_to collections relationship.

Need help with data model

Creating beers at the same time, where beers are linked to establishment. Need a few minutes to figure out how to link them in the data structure.

can't POST in curl

Just re-migrated "sites".
I can do Site.new (with all attributes) in rails console. The table looks fine in rails db.

But when I try to create a new site in curl, I can't, and I get this error:

ActionDispatch::ParamsParser::ParseError

Here's what I'm typing into the console, after logging in the user who will author the "site" and taking that token:

curl --request POST --header "Authorization: Token token=2f6ec10093655ee88450e15cba76de36" --header "Content-Type: application/json" -d '{
"site": {
"name":"Stairs",
"description":"Short-range people watching",
"category":"Seating",
"address":"1801 Mass Ave",
"neighborhood":"Porter Square",
"scale:"medium",
"coverage":"minimal",
"busy":"somewhat"
}
}' http://localhost:3000/sites

Where else should I look for issues?

Need Help

This is a 2 for one. Scott and I are having problems with a POST curl command

curl --request POST --header "Authorization: Token token=be249dc0231396806f24c953cafae03a" --header "Content-Type: application/json" -d '{ “guide": { “name”:"English" } }' http://localhost:3000/guides

getting a parsing error and weve spent a good hour looking up whats wrong

def create guide = current_user.guides.create(guide_params) if guide.save render json: guide, status: :created else render json: guide.error, status: :unprocessable_entity end

def guide_params params.require(:guide).permit(:name) end

Need some help working through app logic

Figured this is a separate issue from the registration issue, so I thought I'd be fair and submit a separate issue. I've written out my app logic and have started trying to group similar events together to write the js functions, but I'd like some guidance on laying all of this out. I tried to talking it through to my cat this morning with some success, but I'm ready for a knowledgable human.
Below is the outline of data tables and what users need to be able to do with that data.

Stories
The most recent completed story is available to read on the login/registration page
Stories are complete when Outline changes
The story in progress is visible only after a contribution is submitted

Outines
Outlines are provided from the database upon login
Outlines change every ten Contributions

Clues
Users receive clues from the previous user upon login, unless you are the first user
After they submit their contribution, users submit clues for the next user

Contributions
Users make a contribution and submit it upon login
A contribution is appended to the story in progress after submission
Stories are made up of ten contributions

Thanks!

help with handlebars data access

I'm trying to access data from the server using Handlebars, and I can get data using the {{#each}} method, but outside if it I can't seem to get at the data. (It simply doesn't display) I suspect what I want to do is not possible (I looked at the docs, and it depends on the definition of 'simple path') I'd like someone to take a look and tell me it's impossible before restructuring my app to get the info a different way.

I'm trying to better understand routes and controllers.

My register/POST requests ARE working. I can enter the email/password into my front-end application and they DO get saved to my users table in my database, yay!

My Question: What I'm curious about is this, when I tested it in postman why does it say current_user: false? Is current_user always false? Like I said it seems to be functioning, but I was curious.

{"user":{"id":4,"email":"[email protected]","current_user":false}}

Need help with my curl commands

My curl is giving me error "NoMethodError (undefined method comment' for #<Comment:0x007fb2f52c2f90>): app/controllers/auth_controller.rb:9:inlogin'" but I haven't changed the auth_controller. Can I get some in-person help please tonight?

help with BootStrap

I've done a quick check on the bootstrap document and it's not immediately evident how to accomplish the following: I want to create a table that has rows of wines. When want to be able to select a row then click a button to initiate further action on the item in the selected row

adding search/query functionality in a controller

I'm entering a word into a searchbar and based on what word I enter I'm trying to have my database update the frontend where a previously created word, definition, and sample sentence have been stored.

I can authenticate a user, yet cannot post a new bike to my database

So... I can successfully register and login a user through the backend and the frontend through AJAX requests. I can successfully do GET requests to the backend and receive data to use in my frontend (i.e., populate a div with data collected from the backend).

I can successfully create a new bike from the backend using pry and using Postman using authentication.

However. I cannot successfully create a new bike POST from the front end.

The error message I am receiving when I attempt to do an ajax POST request is:

POST http://localhost:3000/bikes
localhost/:1 XMLHttpRequest cannot load http://localhost:3000/bikes. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:5000' is therefore not allowed access. The response had HTTP status code 500.

see attached image

screen shot 2015-11-10 at 9 07 11 am

I have googled, I have asked classmates, I've looked at my Rails backend to see if there's an issue. I'm not sure if my bikes_controller.rb file is not set up correctly for creating a new bike.

CRUD q

Similar question to Jeff's earlier; I've gone through the lessons and I think I just need to run through CRUD as it relates to my project with someone. One specific issue: Because I added conditions to the queries in my models (I think this is maybe the right way to say that?) I don't know which words to point to in my routes. Or, here are my models and I don't know if I should get sites or my_sites, etc.:

class User < ActiveRecord::Base
has_many :my_sites, class_name: 'Site'
end

class Site < ActiveRecord::Base
belongs_to :creator, class_name: 'User'
end

Sorry -- this isn't elegantly asked.

How to GET data from two related tables, in one controller

I have a books table and a ratings table. A book has_one rating, and a rating belongs_to book.

When I make a GET request to http://localhost:3000/books I would like to get data back on the books as well as their ratings. I am not sure how to structure the books controller to do this?

I tried making a an instance variable @Rating to hold book.rating, and then rendering this in json, ...didn't work.

create ajax request isn't connecting to backend controller

Can't quite figure out what's wrong with my createWord method. I keep getting the following error:

Started POST "/words" for ::1 at 2015-11-10 16:07:35 -0500
Processing by WordsController#create as HTML
  Parameters: {"words"=>"hi"}
  User Load (0.2ms)  SELECT  "users".* FROM "users" WHERE "users"."token" = $1 LIMIT 1  [["token", "5eff73f3f4efebaf181524701fe03f6f"]]
Completed 400 Bad Request in 1ms (ActiveRecord: 0.2ms)

ActionController::ParameterMissing (param is missing or the value is empty: word):
  app/controllers/words_controller.rb:42:in `word_params'
  app/controllers/words_controller.rb:17:in `create'


  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (3.6ms)
  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.9ms)
  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.9ms)
  Rendered /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (42.8ms)

Curl register request failing

Here is my curl request:

curl --include --request POST --header "Content-Type: application/json" -d '{
"credentials": {
"email": "[email protected]",
"password": "an example password",
"password_confirmation": "an example password"
}
}' http://localhost:3000/register

Here is the error:
Started POST "/register" for ::1 at 2015-11-11 13:19:55 -0500
Processing by AuthController#register as /
Parameters: {"credentials"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}
(0.2ms) BEGIN
User Exists (0.5ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1
SQL (1.7ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "token") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["email", "[email protected]"], ["password_digest", "$2a$10$ci6ZIs0XYsXeeYlJOH0zQ.ump8PE3HQWBnKSkE66SUPQdiht3W/wy"], ["created_at", "2015-11-11 18:19:55.375057"], ["updated_at", "2015-11-11 18:19:55.375057"], ["token", "a8157740c31ed7324cbb1250bf069076"]]
PG::NotNullViolation: ERROR: null value in column "name" violates not-null constraint
DETAIL: Failing row contains (12, [email protected], a8157740c31ed7324cbb1250bf069076, $2a$10$ci6ZIs0XYsXeeYlJOH0zQ.ump8PE3HQWBnKSkE66SUPQdiht3W/wy, 2015-11-11 18:19:55.375057, 2015-11-11 18:19:55.375057, null, null).
: INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "token") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
(0.2ms) ROLLBACK
Completed 500 Internal Server Error in 97ms (ActiveRecord: 2.6ms)

Getting started on my CRUD calls

I have looked online and added the forms. I would appreciate a little help seeing for the forest for the trees on this one. I run through our lessons but it's not clicking.

I have a seed error

Whenever I run rake db:seed I keep getting an error of unknown attribute kind for crop.

  • I have gone ahead and made sure that the column is present in my controller.
    • In my schema the column kind is seen as part of the crop table.
    • the error seems to point to the syntax I have in my seeds file.
    • In the database, the column kind does not exist even though it is part of my schema. Please see my schema below:

Please help me resolve this issue.

bulk load csv file using rails console

I am trying to bulk load a csv file into my database. I have run 'rails g task db parks' then updated the rake.db file using the rails-crud lesson as an example. Then I ran 'rake -T db:populate'. The terminal runs it successfully, but when I look at the database itself after running 'SELECT * FROM parks' it shows that I have 0 rows.

I'm not sure if my models fit what I'm trying to accomplish in my app

So... I've successfully created a one-many relationship between two tables, however, I'm not sure if I've created the models correctly to integrate with the other model (or two) that I'm looking to use for this project.

I have the a map of the erd, yet I'm not sure my thought process is sound with respect to tying together certain relationships between users and my models. Can someone look at my erd and how I've set up my models so I can be sure I'm on track when I try more tests with dummy data?

Patch request for /profiles controller

My patch request in my profiles controller is wrong. Server response involves:

Started PATCH "/profiles/?user_id=1" for ::1 at 2015-11-11 12:24:14 -0500
ActionController::RoutingError (No route matches [PATCH] "/profiles"):

Controller looks like this:

# PATCH /profiles/1
  def update
    if @profile.update(update_params)
      head :no_content
    else
      render json: @profile.errors, status: :unprocessable_entity
    end
  end

referencing this:

  def update_params
    params.require(:profile).permit(:nickname, :zip_code, :user_id)
  end

Why are certain DOM elements are showing, when they should be hidden?

I am having trouble controlling what is hidden and what is showing in my app. I have a ux.js file for controlling the state of the page view and determine which elects are hidden. But for some reason certain elects are not hiding when they should be.

I have tried changing the order in which I load my scripts. And I have tried putting a couple js functions in a $(document).ready wrapper. But ca't figure it out.

Thanks!

Cannot create profile after logging in with curl.

I log in with a user and take the token i receive from the server.
When trying to create a profile with that token, I receive "HTTP Token Access Denied".

The controller looks like this:

def create
    @profile = current_user.create_profile(profile_params)

    if @profile.save
      render json: @profile, status: :created, location: @profile
    else
      render json: @profile.errors, status: :unprocessable_entity
    end
  end

This works if I try to create a profile within the rails console, so i'm not sure what i'm missing.

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.