It took me a little while, but I finally got this working. You'll need the iCalendar plugin.
require 'icalendar'Â
def view_ical
 request = Net::HTTP::Get.new('/calendars/calendar.ics')Â
response = Net::HTTP.start('webdav.site.com') {|http|Â
request.basic_auth 'username', 'password'Â
response = http.request(request)Â
}Â
calendar_text = response.body
calendars = Icalendar.parse(calendar_text)Â
calendar = calendars.first
end
read more >
This one is harder than it seems. But, I figured out a way. The trick and breakthrough came from Teflon Ted.
With a regular form, you could do this in your select statement:
:onChange=>"this.form.submit();"
This won't work with a remote form, because the submission is not handled with the submit method but rather within the JavaScript callback in onsubmit. So, with a remote form, you have to change it to this:
:onChange=>"this.form.onsubmit();"
So, here is my code.
<%- remote_form_for
:user,
user,
:url=>{:action=>'update_remote', :id=>user.id},
:html=>{:id=>'form_'+user.id.to_s},
...... read more >
It seems like it would take a lot of work to get the in_place_editor to work in a partial on a collection, but it does. (It took me a lot of time to figure this out, but maybe I'm just more than average dense.) The best post to-date on this is at we eat bricks.
Just add the usual in the controller (user_controller.rb):
in_place_edit_for :user, :name
And, of course, the method:
def edit
@users = User.find(:all)
end
Then, in the main view (edit.rhtml):
<%= render :partial=>'user', :collection=>@users %>
Then, in the partial (_users.rhtml):
<%= in_place_editor_field :model, :column... read more >
Nested resources in Ruby on Rails are sort of neat, but they are a pain to implement. What's more, I have to ask myself, why bother?
If a resource has a unique identifier id, then why would you need to call its parent resource to call it? The unique identifier is enough. And what resource doesn't have a unique id these days?
read more >
Geoffrey Grosenbach's Ruby on Rails plugin calendar_helper is simple and easy to use. Maybe I'm just picky, but one part of it just wasn't working right for me.
Originally, it looks like this on line 96:
cal << %(<caption class="#{options[:month_name_class]}"></caption><thead><tr><th colspan="7">#{Date::MONTHNAMES[options[:month]]}</th></tr><tr class="#{options[:day_name_class]}">)
It doesn't really make sense for the month name to be in a TH tag and the caption to be empty. So, I put the month name in the caption and eliminated the extra table row. In the end I changed it to this:
cal...... read more >
If you want to move your Wordpress permalinks via 301, you can try to do it by hand using rewrites in your .htaccess file. Much easier is Dean's Permalinks Migration Plugin for Wordpress.
On my work blog (http://www.synaxisworks.com/blog/), I used to use the default "?p=post-number" format, and I wanted to change to a more SEO-friendly format. I setup Dean's plugin. The first problem is that I didn't know what to put for the "old permalink structure". I tried a million combinations of text, regex, and Wordpress codes to try to get it to match the default format.
It turns out, according to... read more >