Git Product home page Git Product logo

lunch's Issues

Preference Uniqueness Validation needed

We need to make sure that any particular user can only have 1 preference for a given restaurant. In other words, a User should not be able to 'Like' and 'Dislike' the same Restaurant, or, a User should not be able to "double" 'Like' a Restaurant.

This should be as simple as giving Preference a validates_uniqueness_of validation on restaurant_id, scoped to user_id ...

e.g., in the Preference model:

validates_uniqueness_of :restaurant_id, scope: :user_id

NoMethodError in Preferences#new

NoMethodError in Preferences#new

Showing /Users/errinlarsen/Code/Rails/lunch/app/views/preferences/_form.html.erb where line #2 raised:

undefined method `likes' for #Preference:0x007fef1cfb06b8
Extracted source (around line #2):

1: <%= simple_form_for(@preference) do |f| %>
2: <%= f.input :likes %>
3: <%= f.input :dislikes %>
4: <%= f.button :submit %>
5: <% end %>
Trace of template inclusion: app/views/preferences/new.html.erb

Rails.root: /Users/errinlarsen/Code/Rails/lunch

Application Trace | Framework Trace | Full Trace
app/views/preferences/_form.html.erb:2:in block in _app_views_preferences__form_html_erb___1564734051096441712_70332480177420' app/views/preferences/_form.html.erb:1:in_app_views_preferences__form_html_erb___1564734051096441712_70332480177420'
app/views/preferences/new.html.erb:8:in _app_views_preferences_new_html_erb___2804989799273048826_70332485700800' app/controllers/preferences_controller.rb:34:innew'
Request

Parameters:

None

Convert views from ERB to HAML.

I think it would be beneficial to convert the views from ERB to HAML.

HAML is easier to read and, besides other benefits, would prevent you from ever forgetting to include a matching closing tag in your markup.

NoMethodError in Preferences#new

Showing /Users/errinlarsen/Code/Rails/lunch/app/views/preferences/_form.html.erb where line #1 raised:

undefined method `model_name' for NilClass:Class
Extracted source (around line #1):

1: <%= simple_form_for(@entry) do |f| %>
2: <%= f.input :likes %>
3: <%= f.input :dislikes %>
4: <%= f.button :submit %>
Trace of template inclusion: app/views/preferences/new.html.erb

Rails.root: /Users/errinlarsen/Code/Rails/lunch

Application Trace | Framework Trace | Full Trace
app/views/preferences/_form.html.erb:1:in _app_views_preferences__form_html_erb___1564734051096441712_70332485679300' app/views/preferences/new.html.erb:8:in_app_views_preferences_new_html_erb___2804989799273048826_70332485700800'
app/controllers/preferences_controller.rb:34:in `new'
Request

Parameters:

None

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.