I am sure this is doable but I can't find a specific example and my
brain is frazzled.
Basically, I am doing a whole load of in-place editing and need
methods to support the updates.
Surely there is a generic way I can do this so that I can do something
like
def set_blog_website
@faq = update_column(:blog_website)
end
def update_column(column_name)
faq = Faq.find(params[:id])
faq.column_name = params[:value]<<-- here's what I don't know how to
do!
faq.save!
@faq = faq
do_ret
end
Any ideas on how I could set the attribute? Faq is an
ActiveRecord::Base object.
I am sure this is doable but I can't find a specific example and my
brain is frazzled.
Basically, I am doing a whole load of in-place editing and need
methods to support the updates.
Why aren’t you just defining it as @faq at the start? That would get rid of the needeless definition of the local variable “faq” and the line where you tell it the instance is the same as the local.