Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

Tomás Charad's Profile

GitHub User: tomascharad


Comments by Tomás Charad


Ok, I've done it:


<%= link_to "<", {date: @date.prev_month}, id: "calendar-main-month-left-arrow", remote: true %>
<%= @date.strftime("%B %Y") %>
<%= link_to ">", {date: @date.next_month}, id: "calendar-main-month-right-arrow", remote: true %>

<%= render "calendar_days" %>

(Here you place just the rendering of the helper starting with
<%= calendar @date do |date| %>
and finishing with
<% end %>
$("#calendar-main-month-left-arrow").attr("href", "/?date=<%= @prev_date %>&prev=true")
$("#calendar-main-month-right-arrow").attr("href", "/?date=<%= @next_date %>&next=true")
$("#calendar-days").replaceWith("<%= j render 'calendar_days' %>")
$("#calendar-main-month-span").html("<%= j @date.strftime('%B %Y') %>")

and in your controller:
if params[:date]
@prev_date = Date.strptime(params[:date],"%Y-%m-%d") - 1.month
@date = Date.strptime(params[:date],"%Y-%m-%d")
@next_date = Date.strptime(params[:date],"%Y-%m-%d") + 1.month
render "date"

Let me know if it helps ;), you can help yourself with episode #136 (revised)


How did you do it to not get a hang when rendering the pdf? Are the application.css styles applied to your pdf?
I've been stuck in this a long time.



What I did was

invoice.attributes = row.to_hash.slice(*Invoice.attribute_names())