HAML:
= link_to 'redeem', redeem_admin_organization_path(organization), :class => 'button_short live redeem'
Controller:
def redeem
@organization = Organization.find(params[:id])
@organization.update_attribute('accumulated_credits', '0')
end
redeem.js.haml:
== $("#organization_#{@organization.id} .redeem").html("#{escape_javascript(link_to('redeem', redeem_admin_organization_path(@organization), :class => 'button_short live redeem'))}");
This is returning the error:
NoMethodError (undefined method `accumulated_credits=' for #<Organization:0x2f3242c>):
Doesn't look like the error is haml or json related -- I think it's in the @organization.accumulated_credits assignment; looks like it doesn't exist
Can you confirm that exists (either through schema.rb or using the console?)
@organization.update_attribute('accumulated_credits', '0')
...
NoMethodError (undefined method `accumulated_credits=' for #<Organization:0x2f3242c>):
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.