18 Nov '12, 6pm

ruby - Rails auto update database attribute after clicking submit on a ...: I am using simple_form in rails to c...

I am using simple_form in rails to create certain events. To create a new event, you are required to login as a user. The form will ask the user to enter the event name, start date, and end date. When the user clicks the submit button, I want the form to automatically update the attribute user_id in the database. Right now in the database, the user_id field in the events table is always set to null. However I need this attribute to be set to: events.user_id = current_user.id Here is my events table for more info: Note: I manually entered the values for user_id in this database. Question: How do I update a database attribute, after a user clicks submit? Or is there a default way of always setting the user_id when a new event is created? Here is the code in the new.html.erb events view <%= simple_form_for(@event) do |f| %> <%= f.error_notification %> <div class="form-inputs"...

Full article: http://stackoverflow.com/questions/13443299/rails-auto-up...

Tweets

Blog update!

Blog update!

Fear of color? Not sure if you should get a green or maroon pants? I think this is convincing enough…I’m all over green an...

Workshop Update

Workshop Update

tramway.co.uk 28 Nov '12, 2pm

Sheffield 510's panels are being carefully removed so that the intricate artwork can be copied for the new panels. 510's s...

Website, Database &amp; Dashboard Design w/ Rub...

freelancer.com 21 Nov '12, 1pm

Freelancer.com (formerly GetAFreelancer) is the world's largest outsourcing and crowdsourcing marketplace for small busine...

Profiling Ruby, or, How I Made Rails Start Up F...

blog.tddium.com 20 Nov '12, 2pm

records that we’re spending time in a function, it can also record the whole call stack so we can blame the callers too. T...

Building video chat confidence, fixing bad migr...

twitter.com 18 Nov '12, 3pm

Developer @ PureCharity.com, advocate for education, ruby & rails, passionate servant, and always my family's biggest fan.

#CrowdInt Blog Post: "Creating and using module...

blog.crowdint.com 20 Nov '12, 5pm

require 'spec_helper' describe Modules::ResourceDestroyer do subject { Modules::ResourceDestroyer } describe :destroy_with...

Advanced Caching in Rails: Revised #rails #ruby

broadcastingadam.com 18 Nov '12, 10am

Advanced Caching in Rails: Revised July 11, 2012 | rails tutorials I've decided to finally update my advanced caching post...