Was asked today to implement a simple application that lets people submit tickets without persisting them to the database. This is going to work perfectly. Thanks Ryan!
I used Valuable gem to implement something similar to activeattr with type and default. I'm using it with redis for persistence and it's working great so far.
Will this gem work with associations? I'm looking to use a tableless model with nested forms. This gem appears to not be the answer. Roger mentioned the Modest Model gem above, but the readme states it is something the author would like to implement but theres not been any activity for 8 months on the project.
This github issue might help you fix the problem, it looks like you want to substitute all references to activerecord with activemodel. Make sure you do it in your locale file too.
HOw would you send the message after that? I can generate the form, but I'd like to see the continuation, where he commented out in the controller.
Thought to use NotificationsMailer.new_message(@message).deliver but this gives me error: undefined methodattribute' for Message:Class`
This may be due to the fact we dont use activeRecord.
I get an issue when I include validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i in app/models/message.rb. If I replace it with /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i (found at Contact us functionality in Rails 3 - answer from JJD) it seems to work.
The error I receive says "The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?"
Note* I am using Rails 4 - not sure if it makes a difference. Does anyone else have this problem?
In rails 4 it seems that attr_accessible is removed from the model, and is not used any more. In general, I have difficulties getting this to work, and would have wanted to see an updated version with rails 4!
Was asked today to implement a simple application that lets people submit tickets without persisting them to the database. This is going to work perfectly. Thanks Ryan!
Great Episode!
I'm using modest model. It's very similar and an alternative if someone is looking for.
OMG. I was struggling this week with a database less model and here is a railscast on this! Thanks Ryan!
Wouldn't that be a good way to call an external API?
So you could easily switch between a internal Database or external datastorage.
How do you call external APIs?
I used Valuable gem to implement something similar to activeattr with type and default. I'm using it with redis for persistence and it's working great so far.
creating contact pages used to be a bit of a pain, but this makes life much easier
Will this gem work with associations? I'm looking to use a tableless model with nested forms. This gem appears to not be the answer. Roger mentioned the Modest Model gem above, but the readme states it is something the author would like to implement but theres not been any activity for 8 months on the project.
Are the attributes translateable? The default path (
de.activerecord.attributes.message.subject: Betreff
) fails.This github issue might help you fix the problem, it looks like you want to substitute all references to
activerecord
withactivemodel
. Make sure you do it in your locale file too.HOw would you send the message after that? I can generate the form, but I'd like to see the continuation, where he commented out in the controller.
Thought to use
NotificationsMailer.new_message(@message).deliver
but this gives me error:undefined method
attribute' for Message:Class`This may be due to the fact we dont use activeRecord.
I get an issue when I include
validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
in app/models/message.rb. If I replace it with/\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
(found at Contact us functionality in Rails 3 - answer from JJD) it seems to work.The error I receive says "The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?"
Note* I am using Rails 4 - not sure if it makes a difference. Does anyone else have this problem?
Yep, had the same error. Thanks for helping me figure this out.
In rails 4 it seems that attr_accessible is removed from the model, and is not used any more. In general, I have difficulties getting this to work, and would have wanted to see an updated version with rails 4!