I am brand new to rails and I am attempting to make my first web app.
I have quickly run into my first problem however that I can’t seem to
get by. It seems like it would be easy to get around (with my
knowledge of other languages besides ruby), but I can’t seem to get by
Right now, I have a note model that contains attributes, :title
(string) :content (text) and :tags (string)
In my models/note.rb file, all I have is this:
class Note < ActiveRecord::Base
validates_presence_of :title, :content
What I want to have done with my tag field though is a different
matter. What I want to happen is that if the tag field is left blank,
a place-holding “@untagged” string would be put into the :tags string.
What I have attempted to do is this in the models/note.rb:
:tags => ‘@untagged’
However, I get a syntax error.
app/models/note.rb:3: syntax error, unexpected ‘=’, expecting kEND
:tags = ‘@untagged’
How should I go about solving this problem? Should I put this in a
different part of the application to do the comparison?
Thanks for your help in advance!