erb

    0熱度

    1回答

    somevariable = "hello" answer = {yesorno: "yes"} anotheranswer = {whatisit: somevariable} erb :index, :locals => answer, anotheranswer 當我嘗試運行它說服務器: 語法錯誤,意想不到的 '\ n',期待=>。 如果我從當地人中刪除an

    4熱度

    1回答

    我有一個基本的靜態網頁。 class StaticPagesController < ApplicationController def home end end 還有一個只有標題的home.html.erb。這部作品在研究與開發但測試 test "should get home" do get :home assert_response :succe

    0熱度

    2回答

    Becouse我想在咖啡文件中執行Rails代碼我將我的腳本文件命名爲「picture.coffee.erb」及其代碼看起來像這樣: drawDots = (x) -> canvas = document.getElementById 'picture' context = canvas.getContext '2d' drawDot(context, i['dim_

    0熱度

    1回答

    我希望我的博客網站上的用戶能夠在textarea中輸入減價文字來製作博客帖子。然後這個降價文本將被轉換成像Redcarpet或kramdown這樣的工具。現在我也希望用戶能夠調用展示一些圖片的局部視圖。因此,換句話說,我希望用戶能夠在下面的代碼輸入之間的任何地方他降價文本(它被解釋爲ERB代碼) <%= render partial: "slider", locals: {imgs: ["imag

    2熱度

    2回答

    我想在我的rails應用程序中使用引導圖形作爲鏈接。要做到這一點沒有glyphicon我會使用的link_to方法: <%=的link_to「向上」,like_post_path(後),方法:把%> 我基本上要「向上」是一個glyphicon代替。但我無法弄清楚如何添加一個鏈接,並仍然保留glyphicon。這裏是我的ERB所有代碼視圖有關我需要的按鈕: <a href="" class="btn

    6熱度

    2回答

    你會如何製作具有人類可讀性json的erb模板? 下面的代碼工作,但它是一個平坦的JSON文件 default.rb default['foo']['bar'] = { :herp => 'true', :derp => 42 } recipe.rb template "foo.json" do source 'foo.json.erb' variables :settin

    5熱度

    4回答

    我有一個助手,看起來像這樣: if current_user.find_voted_items(vote_scope: :inspired).include?(post) link_to vote_inspired_post_path(post, vote_scope: :inspired), method: :post, data: { confirm: 'Are you sure t

    0熱度

    3回答

    我目前正在設計我的網站的輸入文件按鈕。到目前爲止,我已經改變了原生輸入文件的不透明性,所以它不顯示並給它一個2的z-index,所以這個按鈕仍然是可點擊的。 問題是,沒有輸入文件的本機行爲,我沒有指示文件何時完成上傳。 我如何添加一個JS/JQUERY顯示一點: <i class="fa fa-check"></i> 我旁邊的按鈕,當文件上傳完畢。 這裏是我的html的樣子: <%= simp

    1熱度

    1回答

    我有這個鏈接時觸發地雷「show_replies」方法「鳴叫」控制器 <% @replies_link = link_to "show replies", tweets_show_replies_path(:parent => tweet, active: false), method: :post, remote: true, class: "show-replies" %> ,你可以看到它

    1熱度

    1回答

    廚師是偉大的供應基本模板,但我期待將更多先進的模板邏輯。是這樣的可能: <% def say_hi() -%> <%= "hi" %> <% end -%> # Extraneous template data here <% say_hi() -%> # Call to template method 在這個例子中,我希望,每當say_hi()叫hi會產生,但它不