any thoughts re what would be different for rails 3.0? #20

Closed
jpwynn opened this Issue Dec 18, 2012 · 9 comments

Projects

None yet

2 participants

@jpwynn
jpwynn commented Dec 18, 2012

Hi, I like the simplistic aspect of the gem. Even though you very clearly say for rails 3.2, thought I'd try it for my 3.0.13 app... not too surprisingly it won;t get to first base...

wrong number of arguments (1 for 0)

Extracted source (around line #1):

1: <%= calendar @my_schedules do |event| %>
2:

<%= event.priority %>

3: <% end %>

Just wondering if you have any hints where I might go about modifying this to work with Rail 3.0? Not sure if it's 3.2 through-and-through, or if there might be just 1 or 2 little tweaks required?

Regardless, great work on coming up with a simple solution instead of the every-tool-in-the-kitchen approach of most gems.

@excid3
Owner
excid3 commented Dec 18, 2012

So I think the main compatibility thing you're going to find was that in Rails 3.2 they added some functionality to handle changing the first day of the week in a couple methods. I think that's where this is going wrong.

@excid3
Owner
excid3 commented Dec 18, 2012

If you post the full application stack trace that should have a line or two that is in the gem where it was executing. We can use that to trace things back.

@jpwynn
jpwynn commented Dec 18, 2012

I found a similar approach in the Railscast 213, encountered the same error message, fixed it by simply removing the start day in first = date.beginning_of_month.beginning_of_week(START_DAY) - which made it start on Monday instead of being able to select it.

So it might be the same for your gem?

@excid3
Owner
excid3 commented Dec 18, 2012

Yeah I think that's exactly the problem. I'm thinking that only these two places need to change:

https://github.com/excid3/simple_calendar/blob/master/lib/simple_calendar/view_helpers.rb#L29
https://github.com/excid3/simple_calendar/blob/master/lib/simple_calendar/view_helpers.rb#L32

If you want, clone this locally, remove those start_day pieces, add it to your Gemfile with the path option and see if it works for you. If it does, we've got two options for patching this for < 3.2:

  1. Just don't support changing the starting day of the week
  2. Figure out how that works in older versions
@excid3
Owner
excid3 commented Dec 28, 2012

Did you get a chance to take a look at this yet?

@jpwynn
jpwynn commented Dec 28, 2012

I did not try re-incorporating gem since I was under a tight deadline and wasn't actually sure how to edit the gem source then re-incorporate it. (I ended up copying the railscast code and using that instead for my older app)

@excid3
Owner
excid3 commented Dec 28, 2012

No worries! I'm thinking with Rails 4 around the corner and there being enough decent solutions for older versions of Rails <= 3.1 I'll probably close this unless there's a need for it you might still have.

@jpwynn
jpwynn commented Dec 28, 2012

I concur - not much need to chase the old-old versions!

@excid3
Owner
excid3 commented Dec 28, 2012

Cool, thanks for the feedback. 😃

@excid3 excid3 closed this Dec 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment