Search Results

Search found 193 results on 8 pages for 'haml'.

Page 4/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Loading an FLV in Facebox with jQuery for IE7 and IE8

    - by Trip
    It goes almost without saying, this works perfectly in Chrome, Firefox, and Safari. IE (any version) being the problem. Objective: I am trying to load JWplayer which loads an FLV from S3 in a Facebox popup. jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() }) HTML (haml): %li#videoGirl = link_to 'What is HQchannel?', '#player', :rel => 'facebox' .grid_8.omega.alpha#player{:style => 'display: none;'} :javascript var so = new SWFObject('/flash/playerTrans.swf','mpl','640px','360px','0'); so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true'); so.addParam('wmode','transparent'); so.addVariable('file', 'http://hometownquarterlyvideos.s3.amazonaws.com/whatishqchannel.flv&autostart=true&controlbar=none&repeat=always&image=/flash/video_girl/whatishqchannel.jpg&icons=false&screencolor=none&backcolor=FFFFFF&screenalpha=0&overstretch'); so.addVariable('overstretch', 'true') so.write('player'); Problem: Despite the video being set to display: none;. It begins playing anyway. When clicking on the activation div, IE7 pops up a wrong sized blank div with a nav (params are set to not show nav and scrubber), and no buttons on the nav and srubber work. IE8 shows the right size but same behavior with nav and scrubber not working, and blank screen. My guess: I'm thinking that the problem is with the javascript not being called at the right times. It seems it's loading the facebox without the jwplayer. At least I assume. Hence the reason why the nav is there. I thinking that it did not read the javascript for that.

    Read the article

  • Keeping user data persistent after validates_presence_of

    - by mathee
    I'm designing a question-and-answer Ruby on Rails application. After a user logs in, you can see a list of questions posed by other users. I have a link next to each of the questions to /answers/new?question_id=someNumber. That links to a page that displays the question (to remind the "answerer") above a standard form for submitting your answer. In order to display the question, I call @question = Question.find_by_id(params[:question_id]) and reference @question in the Haml view file: Question details %h2 #{h @question.title} #{h @question.description} %br/ %br/ %h1 Your answer - form_for(@answer) do |f| = f.error_messages %p = f.label :description, "Enter your response here" %br = f.text_area :description = f.hidden_field "question", :value => @question.id %p = f.submit 'Answer' The problem is that if I check validates_presence_of :description in Answer.rb, then I lose question_id if the user did not input anything into the description field when the page reloads, so I can't re-display the question for which the user is answering. How should I fix this? Is there a better way of storing the question the user is trying to answer so that I can display it above the form for entering a new answer (and perhaps in other views in the future)? If you need to see more code, please let me know.

    Read the article

  • Nesting Ruby on Rails HAML Checkbox in Label Tag

    - by user1279116
    I have the following code which doesn't work: = form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "well" }) do |f| = f.label :email = f.email_field :email = f.label :password = f.password_field :password - if devise_mapping.rememberable? %p = f.label :remember_me, :class => "checkbox" = f.check_box :remember_me, :class => "checkbox" %div= f.submit "Einloggen" = render :partial => "devise/shared/links" It only works in that way, but I need it in one line and not in wto: %p = f.label :remember_me, :class => "checkbox" = f.check_box :remember_me, :class => "checkbox" Please help! I'm really desprate right now. I just want the checkbox nested in the label for the bootsrap form. I searched google and stackoverflow but found nothing UPDATE: I solved it now like this: - if devise_mapping.rememberable? %p %label.checkbox{ :for => "remember_me" } = f.check_box :remember_me, :class => "checkbox" Remember

    Read the article

  • Changing a select input to a checkbox acting as an on/off toggle switch in Rails

    - by Ribena
    I have a set of 7 dropdown inputs allowing admins to say whether they are open or closed for business on a given day. I'd like that changed to 7 open/closed switches (presumably styled checkboxes?) but can't figure out how to do this! Here are the relevant bits of code I currently have (prior to any change): app/view/backend/inventory_pool/edit.html.haml - content_for :title, @inventory_pool = form_for [:backend, @inventory_pool], html: {name: "form"} do |f| .content - if is_admin? %a.button{:href => root_path}= _("Cancel") %button.button{:type => :submit}= _("Save %s") % _("Inventory Pool") %section %h2= _("Basic Information") .inner .field.text .key %h3= "#{_("Print Contracts")}" %p.description .value .input %input{type: "checkbox", name: "inventory_pool[print_contracts]", checked: @inventory_pool.print_contracts} %section#workdays %h2= _("Workdays") .inner - [1,2,3,4,5,6,0].each do |i| .field.text .key %h3= "#{I18n.t('date.day_names')[i]}" .value .input %select{:name => "store[workday_attributes][workdays][]"} %option{:label => _("Open"), :value => Workday::WORKDAYS[i]}= _("Open") %option{:label => _("Closed"), :value => "", :selected => @store.workday.closed_days.include?(i) ? true : nil}= _("Closed") app/models/workday.rb class Workday < ActiveRecord::Base belongs_to :inventory_pool WORKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] def is_open_on?(date) return false if date.nil? case date.wday when 1 return monday when 2 return tuesday when 3 return wednesday when 4 return thursday when 5 return friday when 6 return saturday when 0 return sunday else return false #Should not be reached end end def closed_days days = [] days << 0 unless sunday days << 1 unless monday days << 2 unless tuesday days << 3 unless wednesday days << 4 unless thursday days << 5 unless friday days << 6 unless saturday days end def workdays=(wdays) WORKDAYS.each {|workday| write_attribute(workday, wdays.include?(workday) ? true : false)} end end And in app/controllers/backend/inventory_pools_controller I have this (abridged): def update @inventory_pool ||= InventoryPool.find(params[:id]) process_params params[:inventory_pool] end def process_params ip ip[:print_contracts] ||= "false" # unchecked checkboxes are *not* being sent ip[:workday_attributes][:workdays].delete "" if ip[:workday_attributes] end

    Read the article

  • Should I learn Sass?

    - by Davey
    I do a lot of design work with XHTML, CSS, and PHP. A friend mentioned Sass to me and it looks pretty cool. I don't know anything about Ruby or Rails and I am running a windows machine. Does anyone know a good tutorial for a beginner to dig in to something like this?

    Read the article

  • possible to define an array in Sass?

    - by yaya3
    wondering if it is possible to use an array with Sass as I find my self repeating the following sort of thing: .donkey h2 background-color= !donkey .giraffe h2 background-color= !giraffe .iguana h2 background-color= !iguana

    Read the article

  • Redirecting users after destroy

    - by mathee
    I have 3 models: Questions, Answers, and Profiles (I know, it should be called "Users"). When you view a question Q, I query the database for the answers to Q. (They are linked by id.) In the view, the current user has the option to delete his answer by clicking on the destroy link displayed next to his answer: %table %tr %td Answers: - @answers.each do |a| %tr %td - @provider = Profile.find(a.provider) %i #{h @provider.username} said: %br #{h a.description} %td = link_to 'View full answer', a %td - if a.provider == @profile.id #{link_to 'Delete my answer', a, :confirm => 'Are you sure?', :method => :delete} The problem is that when the user clicks on the destroy link, it redirects to the /answers/index. I want it to redirect to /questions/Q. What's the best way to do this? I know that there's a redirect_to method, but I don't know how to implement it when I want to redirect to an action for a different controller. It also needs to remember the question from which the answer is being deleted. I tried passing something like :question_id in link_to as: #{link_to 'Delete my answer', a, :confirm => 'Are you sure?', :question_id => @question.id, :method => :delete} In AnswersController#destroy: def destroy @answer = Answer.find(params[:id]) @answer.destroy respond_to do |format| format.html { redirect_to(answers_url) } format.xml { head :ok } end @question = Question.find(params[:question_id]) redirect_to question_path(@question) end The :question_id information is not passed to the destroy method, so I get this error: Couldn't find Question without an ID To confirm, I added a puts call before Question.find, and it returned nil.

    Read the article

  • nested columns in compass/sass

    - by corroded
    I've been studying compass and while it is a fun thing to play with and use, one thing bothers me(besides being unable to add padding as it wrecks the grid), how do I nest columns? I want to be able to do what blueprint does: nest containers like say, I have a 24-column page divided in two(17 and 7 columns). In the right part of that page(the one with 7 columns), I want to divided some elements into two(2 and 5 columns). I tried this: #main +container #main-content +column(17) +box-padding(17, 10px) :margin :right 0 #sidebar +column(7, true) +box-padding(7, 10px) That's the code for the main page. The sidebar contains a list with some labels and input fields li +container :margin :bottom 5px label +column(2) :margin :right 0 input +column(5, true) It kinda works, but inspecting the li in firebug shows that it's width is actually 950px as opposed to be just 270px since it is just 7 columns. I tried googling about nested columns but I can't seem to find any example in compass. I've also tried the wiki and the documentation to no avail.

    Read the article

  • Is it valid syntax to have ordered and unordered lists in sequence in markdown?

    - by nfm
    I just wrote some markdown and it doesn't seem to render correctly. Is it legal syntax to have an ordered list, followed by newlines, then followed by an unordered list? Or is this a bug in bluecloth? For example: 1. One 2. Two 3. Three * Apple * Banana * Carrot Bluecloth creates a single <ul> and nests apple, banana and carrot as <li>'s under it. Stackoverflow's markdown parser does this too. Am I just doing it wrong? Surely this is a common usage case...

    Read the article

  • Using colon syntax and variables in Sass

    - by corroded
    I am still using the old colon syntax (I prefer it more than the bracket syntax) and this particular code: a.button-link +box($main-color) +border-radius(5px) :background :color $main-color :color #fff :padding 5px generates a warning like so: DEPRECATION WARNING: On line 12, character 3 of '/Users/eumir/rails_apps/dxconnect/app/ stylesheets/partials/utilities/_link-styles.sass' Setting properties with = has been deprecated and will be removed in version 3.2. Use "background: $main-color" instead. I tried that but my background color still doesn't show up. Any help on this please? Thanks!

    Read the article

  • How can I call `update_attribute` for a list item in rails then actually update the html using jquery?

    - by Patrick Connor
    I want my users to be able to mark one or more items from an index view as "Active" or "Inactive" using a link. The text for the link should be state aware - so it might default to "Mark as Active" if the corresponding attribute was false or null, and "Mark as Inactive" if true. Once the user clicks the link and the attribute is updated in the controller, the link-text should update based on the new state. I am WAY off here, but this is a small sample of the code I have been trying... CONTROLLER ... respond_to :html, :js ... def update @item = Item.find(params[:id]) if @item.update_attributes(params[:item]) #Not sure of how to respond to .js here end end ... update.js.erb #how do I identify which element to update? $('#item[13456]').html("State aware text for link_to") VIEW - for item in @items = item.name = link_to "Mark as Active", item_path(item), :method => :put, :remote => true. :id => "item[#{item.id}]" I am happy to read any APIs, blogs, tutorials, etc. I just can't seem to get my hands/mind around this task. Any help or guidance is greatly appreciated!

    Read the article

  • Skin Twitter HTML and CSS

    - by hagope
    I am building a twitter application and would like to use the structure of the their homepage. Can anyone suggest how to go about doing this, or point to a reference that does this? I do not intend to use any images that would be considered copyright, I just want to use the single column layout, with the side panel, header, footer. Thanks!

    Read the article

  • twitter bootstrap navbar fixed top overlapping site

    - by Matthew Berman
    I am using bootstrap on my site and am having issues with the navbar fixed top. When I am just using the regular navbar, everything is fine. However, when i try to switch it to navbar fixed top, all the other content on the site shifts up like the navbar isn't there and the navbar overlaps it. here's basically how i laid it out: .navbar.navbar-fixed-top .navbar-inner .container .container .row //yield content i tried to copy bootstraps examples exactly but still having this issue only when using navbar fixed top. what am I doing wrong?

    Read the article

  • How to disable Rails submit buttons alongside Prototype helpers & RJS?

    - by Jesse
    I'm trying to follow this post http://stackoverflow.com/questions/576240/how-can-i-unobtrusively-disable-submit-buttons-with-javascript-and-prototype but I can't get it to work. The form triggers an RJS function, so I need to keep the helpers' onclick events intact. The RJS returns/reloads the same forms along with two new texts. I'm really confused. Here is my rails code for the forms: .span-20#comparison / new comparison . . . / voting forms (also reloaded) .span-4.prepend-3.append-6 - form_remote_tag :action => url_for(:controller => :comparisons), :method => :post do = hidden_field_tag :poem1_id, poems[:a].id = hidden_field_tag :poem2_id, poems[:b].id = hidden_field_tag :response, 1 = submit_tag "Vote for me", :disabled => false, :disable_with => 'Vote for me', :class => "compare" .span-4.append-3.last - form_remote_tag :action => url_for(:controller => :comparisons), :method => :post do = hidden_field_tag :poem1_id, poems[:a].id = hidden_field_tag :poem2_id, poems[:b].id = hidden_field_tag :response, 2 = submit_tag "Vote for me", :disable_with => 'Vote for me', :class => "compare" .span-4.prepend-8.append-8.prepend-top.last - form_remote_tag :action => url_for(:controller => :comparisons), :method => :post do = hidden_field_tag :poem1_id, poems[:a].id = hidden_field_tag :poem2_id, poems[:b].id = hidden_field_tag :response, 'draw' = submit_tag "Declare Draw", :disable_with => 'Declare Draw', :class => "compare" RJS page.replace_html :comparison, :partial => 'poems', :object => @poems page.insert_html :top, :previous, :partial => 'comparison', :object => @comparison page << "Effect.ScrollTo($('top'));"

    Read the article

  • fieldWithErrors not wrapping every error field

    - by Teef L
    Notice the following result when I submit blank :title and :description fields The validations are in the controller: class Question < ActiveRecord::Base validates_presence_of :title validates_presence_of :description And, the form is generated with those names: -form_for(@question) do |f| = f.error_messages = f.label :title = f.text_field :title, :size => 50, :onchange => remote_function(:url => {:action => :display_tag_suggestions}, :with => 'Form.Element.serialize(this)') #suggestions = f.label :description = f.text_area :description ... But, for some reason, only :title gets wrapped in the error div tags: <form action="/questions" class="new_question" id="new_question" method="post"> <div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="6HQaiu1D0gBQcKw2pLeZP6Jvn0FSClPD5Sk9HwegzPg=" /></div> <div class="errorExplanation" id="errorExplanation"> <h2>2 errors prohibited this question from being saved</h2> <p>There were problems with the following fields:</p> <ul> <li>Title can't be blank</li> <li>Description can't be blank</li> </ul> </div> <label for="question_title">Title</label> <div class="fieldWithErrors"><input id="question_title" name="question[title]" onchange="new Ajax.Request('/questions/display_tag_suggestions', {asynchronous:true, evalScripts:true, parameters:Form.Element.serialize(this) + '&amp;authenticity_token=' + encodeURIComponent('6HQaiu1D0gBQcKw2pLeZP6Jvn0FSClPD5Sk9HwegzPg=')})" size="50" type="text" value="" /></div> <label for="question_description">Description</label> <textarea cols="40" id="question_description" name="question[description]" rows="20"></textarea> ... I don't think that behavior is expected. The problem most people have is that it's wrapping things with divs, which won't display properly. My problem is that fields aren't being wrapped with divs to begin with! I haven't made any (conscious) changes to how errors are handled, so I'm not sure why it's not working properly.

    Read the article

  • RoR: Condition Always False - Why?

    - by Matt Hollingsworth
    Working in RoR 2.3.x. My quiz_results table has a row for user_id (3907) and result (0.1), and two users I'm looking at with no rows in the quiz_results table. This line keeps returining false: -if QuizResult.find_by_user_id(@user_id).present? But if I change it to anything that returns true, the next line reports an error on the * method: ="#{(QuizResult.average('score', :conditions => 'user_id = #{@user.id}') * 100).round}%" The beginning of the code is a loop: [email protected] do |user| Any ideas how to fix? Have tried unsuccessfully all day.

    Read the article

  • Sinatra Variable Scope

    - by Ethan Turkeltaub
    Take the following code: ### Dependencies require 'rubygems' require 'sinatra' require 'datamapper' ### Configuration config = YAML::load(File.read('config.yml')) name = config['config']['name'] description = config['config']['description'] username = config['config']['username'] password = config['config']['password'] theme = config['config']['theme'] set :public, 'views/themes/#{theme}/static' ### Models DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/marvin.db") class Post include DataMapper::Resource property :id, Serial property :name, String property :body, Text property :created_at, DateTime property :slug, String end class Page include DataMapper::Resource property :id, Serial property :name, String property :body, Text property :slug, String end DataMapper.auto_migrate! ### Controllers get '/' do @posts = Post.get(:order => [ :id_desc ]) haml :"themes/#{theme}/index" end get '/:year/:month/:day/:slug' do year = params[:year] month = params[:month] day = params[:day] slug = params[:slug] haml :"themes/#{theme}/post.haml" end get '/:slug' do haml :"themes/#{theme}/page.haml" end get '/admin' do haml :"admin/index.haml" end I want to make name, and all those variables available to the entire script, as well as the views. I tried making them global variables, but no dice.

    Read the article

  • Paperclip not running tasks but not showing errors

    - by Trip
    This is strange. I just did a deploy to a cluster server, and since then, pictures have not been processing. Reading the logs, I usually do not get an error at all, but they never finish. However, on one particular image, I found this little bit at least, but this might not explain everything.. Any ideas? Processing PhotosController#edit (for 69.248.152.173 at 2010-05-27 04:25:12) [GET] Parameters: {"gallery_id"="2102", "action"="edit", "type"="photo", "id"="15453", "crop"="true", "controller"="photos", "organization_id"="470", "_"="1274959512393"} Rendering media/crop_photo ActionView::TemplateError (/data/HQ_Channel/releases/20100524111501/public/system/photos/15453/original/DSC05193.JPG is not recognized by the 'identify' command.) on line #4 of app/views/media/crop_photo.js.haml: 1: == $("#media_header").html('#{ escape_javascript(render :partial = 'media/crop_photo') }').slideDown("slow"); 2: 3: :plain 4: function updateForm(coords) 5: { 6: var rx = #{PHOTO_IMAGE_WIDTH} / coords.w; 7: var ry = #{PHOTO_IMAGE_HEIGHT} / coords.h; vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/geometry.rb:24:in `from_file' app/models/photo.rb:68:in `photo_geometry' app/views/media/crop_photo.js.haml:4:in `_run_haml_app47views47media47crop_photo46js46haml' haml (2.2.2) [v] lib/haml/helpers/action_view_mods.rb:13:in `render' app/controllers/photos_controller.rb:81:in `crop' app/controllers/photos_controller.rb:24:in `edit' haml (2.2.2) [v] rails/./lib/sass/plugin/rails.rb:19:in `process' lib/flash_session_cookie_middleware.rb:14:in `call' vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in `call' ** [Hoptoad] Failure: Net::HTTPClientError ** [Hoptoad] Environment Info: [Ruby: 1.8.6] [Rails: 2.3.3] [Env: production] ** [Hoptoad] Response from Hoptoad: No project exists with the given API key. Rendering /data/HQ_Channel/releases/20100524111501/public/500.html (500 Internal Server Error) And then a little later, I got this : ActionView::TemplateError (/data/HQ_Channel/releases/20100524111501/public/system/photos/15453/original/DSC05193.JPG is not recognized by the 'identify' command.) on line #4 of app/views/media/crop_photo.js.haml: 1: == $("#media_header").html('#{ escape_javascript(render :partial = 'media/crop_photo') }').slideDown("slow"); 2: 3: :plain 4: function updateForm(coords) 5: { 6: var rx = #{PHOTO_IMAGE_WIDTH} / coords.w; 7: var ry = #{PHOTO_IMAGE_HEIGHT} / coords.h; vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/geometry.rb:24:in `from_file' app/models/photo.rb:68:in `photo_geometry' app/views/media/crop_photo.js.haml:4:in `_run_haml_app47views47media47crop_photo46js46haml' haml (2.2.2) [v] lib/haml/helpers/action_view_mods.rb:13:in `render' app/controllers/photos_controller.rb:81:in `crop' app/controllers/photos_controller.rb:24:in `edit' haml (2.2.2) [v] rails/./lib/sass/plugin/rails.rb:19:in `process' lib/flash_session_cookie_middleware.rb:14:in `call' vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in `call' ** [Hoptoad] Failure: Net::HTTPClientError ** [Hoptoad] Environment Info: [Ruby: 1.8.6] [Rails: 2.3.3] [Env: production] ** [Hoptoad] Response from Hoptoad: No project exists with the given API key. Rendering /data/HQ_Channel/releases/20100524111501/public/500.html (500 Internal Server Error)

    Read the article

  • Getting Started With Sinatra

    - by Liam McLennan
    Sinatra is a Ruby DSL for building web applications. It is distinguished from its peers by its minimalism. Here is hello world in Sinatra: require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end A haml view is rendered by: def '/' haml :name_of_your_view end Haml is also new to me. It is a ruby-based view engine that uses significant white space to avoid having to close tags. A hello world web page in haml might look like: %html %head %title Hello World %body %div Hello World You see how the structure is communicated using indentation instead of opening and closing tags. It makes views more concise and easier to read. Based on my syntax highlighter for Gherkin I have started to build a sinatra web application that publishes syntax highlighted gherkin feature files. I have found that there is a need to have features online so that customers can access them, and so that they can be linked to project management tools like Jira, Mingle, trac etc. The first thing I want my application to be able to do is display a list of the features that it knows about. This will happen when a user requests the root of the application. Here is my sinatra handler: get '/' do feature_service = Finding::FeatureService.new(Finding::FeatureFileFinder.new, Finding::FeatureReader.new) @features = feature_service.features(settings.feature_path, settings.feature_extensions) haml :index end The handler and the view are in the same scope so the @features variable will be available in the view. This is the same way that rails passes data between actions and views. The view to render the result is: %h2 Features %ul - @features.each do |feature| %li %a{:href => "/feature/#{feature.name}"}= feature.name Clearly this is not a complete web page. I am using a layout to provide the basic html page structure. This view renders an <li> for each feature, with a link to /feature/#{feature.name}. Here is what the page looks like: When the user clicks on one of the links I want to display the contents of that feature file. The required handler is: get '/feature/:feature' do @feature_name = params[:feature] feature_service = Finding::FeatureService.new(Finding::FeatureFileFinder.new, Finding::FeatureReader.new) # TODO replace with feature_service.feature(name) @feature = feature_service.features(settings.feature_path, settings.feature_extensions).find do |feature| feature.name == @feature_name end haml :feature end and the view: %h2= @feature.name %pre{:class => "brush: gherkin"}= @feature.description %div= partial :_back_to_index %script{:type => "text/javascript", :src => "/scripts/shCore.js"} %script{:type => "text/javascript", :src => "/scripts/shBrushGherkin.js"} %script{:type => "text/javascript" } SyntaxHighlighter.all(); Now when I click on the Search link I get a nicely formatted feature file: If you would like see the full source it is available on bitbucket.

    Read the article

  • Trouble using termextraction ge

    - by mathee
    I'm trying to install this gem: http://github.com/alexrabarts/term_extraction. It required nokogiri, which I tried installing. I'm getting this as the output: >gem install nokogiri Successfully installed nokogiri-1.4.2.1-x86-mswin32 1 gem installed Installing ri documentation for nokogiri-1.4.2.1-x86-mswin32... No definition for parse_memory No definition for parse_file No definition for parse_with No definition for get_options No definition for set_options Installing RDoc documentation for nokogiri-1.4.2.1-x86-mswin32... No definition for parse_memory No definition for parse_file No definition for parse_with No definition for get_options No definition for set_options I was able to install the termextraction gem (per the README on git repo): >gem install alexrabarts-term_extraction -s http://gems.github.com Successfully installed alexrabarts-term_extraction-0.1.4 1 gem installed Installing ri documentation for alexrabarts-term_extraction-0.1.4... Installing RDoc documentation for alexrabarts-term_extraction-0.1.4... The issue is that I'm trying to test it out, but I'm getting an "uninitialized constant" error when I use it: ActionView::TemplateError (uninitialized constant ApplicationHelper::TermExtraction) on line #3 of app/views/questions/new. haml: 1: %h1 New question 2: -msg = "testing this context thing let's see what it gives me" 3: -getTerms(msg) 4: #new-question-form 5: .box-background 6: -form_for(@question) do |f| app/helpers/application_helper.rb:42:in `getTerms' app/views/questions/new.haml:3:in `_run_haml_app47views47questions47new46haml' haml (2.2.23) lib/haml/helpers/action_view_mods.rb:13:in `render' haml (2.2.23) lib/haml/helpers/action_view_mods.rb:13:in `render' app/controllers/questions_controller.rb:91:in `new' haml (2.2.23) lib/sass/plugin/rails.rb:20:in `process' Here is application_helper.rb: module ApplicationHelper def getTerms(context) yahoo = TermExtraction::Yahoo.new(:api_key => 'myAPIkey', :context => context) end end I'm not sure what the issue is. Any insight would be greatly appreciated!

    Read the article

  • How can I simplify my nested sinatra routes?

    - by yaya3
    I require nested subdirectories in my sinatra app, how can I simplify this repetitive code? # ------------- SUB1 -------------- get "/:theme/:sub1/?" do haml :"pages/#{params[:theme]}/#{params[:sub1]}/index" end # ------------- SUB2 -------------- get "/:theme/:sub1/:sub2/?" do haml :"pages/#{params[:theme]}/#{params[:sub1]}/#{params[:sub2]}/index" end # ------------- SUB3 -------------- get "/:theme/:sub1/:sub2/:sub3/?" do haml :"pages/#{params[:theme]}/#{params[:sub1]}/#{params[:sub2]}/#{params[:sub3]}/index" end # ------------- SUB4 -------------- get "/:theme/:sub1/:sub2/:sub3/:sub4/?" do haml :"pages/#{params[:theme]}/#{params[:sub1]}/#{params[:sub2]}/#{params[:sub3]}/#{params[:sub4]}/index" end

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >