Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redirect_to(url) helper #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Nerian
Copy link
Contributor

@Nerian Nerian commented Mar 9, 2012

Add redirect_to(url) helper

  def submit(evt)
    @task = Task.new(evt[:task])
    @course = Course.find(evt[:course])
    @course.tasks << @task
    if @course.save
      @message = "Task #{@task.title} saved"
      @task = Task.new
      redirect_to course_path(@course.id)      
    else
      update :view => :display
    end
  end

@apotonick
Copy link
Owner

Good idea, but I'm a little bit worried about opening the door to a RJS hell here - we should be careful about adding JS helpers, but principally I like the idea.

@Nerian
Copy link
Contributor Author

Nerian commented Mar 16, 2012

I agree, it shouldn't be Apotomo's responsability to support every kind of js interaction. redirect_to is simply a very common interaction. That it is implemented in JS is simply to decouple it from rails.

@atambo
Copy link

atambo commented Apr 2, 2012

+1, I just ran into needing this today.

@johnlane
Copy link

I needed to do this and found this PR. Does exactly what I needed so another vote from me.

@apotonick
Copy link
Owner

Yepp, the JS solution seems good to me. Test anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants