This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Answers new method | |
| def new | |
| @survey = Survey.find(params[:survey_id]) | |
| @questions = @survey.questions.all | |
| @answers = @questions.map{|q| q.answers.build} | |
| respond_to do |format| | |
| format.html # new.html.erb | |
| format.xml { render :xml => @answer } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| search.html.erb | |
| <%= form_tag(:action => "search") do %> | |
| <%= label_tag(:q, "Search for:") %> | |
| <%= text_field_tag(:wth) %> | |
| <%= submit_tag("Search") %> | |
| <% end %> | |
| -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getUriQuery(url) | |
| dots = url.scan(/\./) | |
| dotsSize = dots.size | |
| httpRegex = '(?![https?:\/\/])' | |
| minimumUriRegex = '([^.]+\.[^.]+\...|[^.]+\.[^.]+)$' # Credit to @blaines | |
| dotsSize -= 1 | |
| appendableRegex = '[^.]+\.'*dotsSize | |
| customUriRegex = minimumUriRegex.insert(18, appendableRegex).insert(1, appendableRegex) | |
| fullUriRegex = httpRegex + customUriRegex | |
| uriToQuery = url.slice(Regexp.new(fullUriRegex)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person < ActiveRecord::Base | |
| before_update :before_update_changes | |
| attr_accessor :update_changes | |
| def before_update_changes | |
| @update_changes = changes | |
| end | |
| end |
NewerOlder