Questions tagged [helpermethods]

85 questions
0
votes
0 answers

laravel accesing resource folder by helper method+ routing

Edit : Solved ,as DigitalDrifter siggested , npm run dev will automatically move all assets deom resouece to public . so dont waste time on resource folder access . as per laravel docs ,I run command php artisan ui vue --auth to create auth…
Neeraj Verma
  • 1,872
  • 4
  • 24
  • 38
0
votes
1 answer

Problem with escaping HTML characters in Rails 3

I use foo helper function in my view: <%= foo ["hello", "stack", "overflow"] %> When foo is defined like this: def foo(arr) result = '' arr.each do |a| result += content_tag(:div, a) end result end The page…
Misha Moroshko
  • 148,413
  • 200
  • 467
  • 700
0
votes
3 answers

How do I work with Rails 3 cookies and helpers?

I created a user and stored the id in a permanent cookie: def save_user_id_cookie cookies.permanent.signed[:user_id] = @user_id end Here is a link. and then try to access it: helper_method :current_user private def current_user @current_user =…
Alex
  • 692
  • 1
  • 9
  • 29
0
votes
0 answers

Meteor and MongoDB rerun helpers function

I'm working on a project to manage the attendance of students in school. The frontend runs with meteor. It displays the presence of all students from one class for the current day. The user (teacher) can switch the days back and forth, to make some…
Jub
  • 1
  • 5
0
votes
3 answers

Using image_url helper in model

I'm trying to use the image_url helper in my model. I also have an image_url property on the model(can't be changed). When I call image_url, the helper method it appears to be calling the method on the model. I get the error wrong number of…
Antarr Byrd
  • 20,852
  • 26
  • 85
  • 154
0
votes
1 answer

How do I define a variable that all my views can access?

I have a Rails 5 web app (almost). I want to include an attribute on all my views. I read somewhere that the way to do this was to define a helper method in my application controller, so I defined class ApplicationController <…
user7055375
0
votes
2 answers

Is there a benefit to create a helper method for only one use?

I notice in Rails tutorials sometimes the authors make helper methods that are only used one time. This strikes me as ridiculous but while learning ActionCable I noticed that DHH did the same thing in his introduction for ActionCable 2 years ago. So…
Steve Carey
  • 2,216
  • 17
  • 22
0
votes
5 answers

Helper Method detect post - comment from user

I'm trying to create a helper method that will display {user.name} has no submitted posts." on the profile show view of user if they haven't yet submitted any posts and display the number posts they have . currently on my show view i have <%=…
0
votes
2 answers

Retrieve method for a polymorphic, has_one and scoped association

Hi this is somewhat it trivial but I can't for the life of me figure out where to make the adjustments. I have a LoanApplication model and a transfer model like this: class LoanApplication < ActiveRecord::Base before_save :populate_guid …
0
votes
1 answer

Ruby on rails: previous url helper for entire application

Is there an easy way to write a helper method to always update the previously visited url in the session. I have tried the method below but the url saved is always the current one. I would like to be able to use this helper in all my controllers for…
Mais
  • 29
  • 5
0
votes
0 answers

Why controllers action doesn't send json data in response

I learn ASP.NET MVC and have some issue. I create two links by ajax helper method in view. They send mailsType argument and response json data. Here is the code of links and AjaxOptions object
iplot
  • 3
  • 2
0
votes
1 answer

Rails: How to determine where a helper methods 'points'

Near the start of this page... http://guides.rubyonrails.org/routing.html ... there's an example involving @patient (section 1.2). I'd like to know how to determine where the following line points: <%= link_to 'Patient Record',…
moosefetcher
  • 1,787
  • 1
  • 19
  • 33
0
votes
2 answers

NoMethodError, undefined method 'bid'

Ive been trying to call a helper method from my controller on a rails object and i continue to get this error. Here is all my code. class AuctionsController < ApplicationController helper_method :bid def bid @auction =…
0
votes
1 answer

Only need simple_format when there are is new line \n

I have some strings that contain carriage return (new lines), and using the helper method simple_format works perfect for that. Unfortunately though, now all strings get the wrapping tag and class defined with simple_format, and that creates…
0
votes
2 answers

Check if a specific script is present from an helper/extension method in MVC C#

Is there a way to check in a helper/extension method if a certain script is present in a view? My idea is to create a custom TextBoxFor() method where the focus is moved to the next input once the present one reach the maxLenght.
Bonomi
  • 2,009
  • 4
  • 29
  • 41