Skip to content

Add redirect_to(url) helper - #71

Open
Nerian wants to merge 1 commit into
apotonick:masterfrom
Nerian:patch-5
Open

Nerian wants to merge 1 commit into
apotonick:masterfrom
Nerian:patch-5

Conversation

@Nerian

@Nerian Nerian commented Mar 9, 2012

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

Nerian commented Mar 16, 2012

Copy link
Copy Markdown
Contributor Author

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

atambo commented Apr 2, 2012

Copy link
Copy Markdown

+1, I just ran into needing this today.

@johnlane

Copy link
Copy Markdown

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

@apotonick

Copy link
Copy Markdown
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