0

My rails app is getting this error:

syntax error, unexpected ',', expecting =>

The line in my model that it is complaining about is this:

validates :body, presence: true, 
          length: {minimum: 2, maximum: 1000}, 
          :chat_room_id, :user_id

Seems to be the comma between :chat_room_id and :user_id

Any ideas? Thanks!

2 Answers 2

3

you cannot write validation condition and after that, what to validate:

If presume you want something like this:

validates :body, presence: true, length: {minimum: 2, maximum: 1000}
validates :chat_room_id, :user_id, presence: true

Or another option:

validates :body, :chat_room_id, :user_id, presence: true
validates :body, length: {minimum: 2, maximum: 1000}
Sign up to request clarification or add additional context in comments.

Comments

0

My parameter list: {:utf8, :authenticity_token, :worklog => {:typee, :do, :todo, :feel, :plan_done, :plan, :week_feel, :score, :good, :nogood}, :commit}

after add thoes parameter get empty value in database

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.