An ActionView::Template::Error occurred in posts#index:
couldn't find file 'jquery'
(in /opt/ruby_apps/bookdate-website/app/assets/javascripts/cpanel_app.coffee:1)
sprockets (2.1.3) lib/sprockets/context.rb:100:in `resolve'
An ActionView::Template::Error occurred in topics#show:
cannot load such file -- html/tokenizer
actionpack (3.2.8) lib/action_controller/vendor/html-scanner/html/sanitizer.rb:18:in `tokenize'
sometimes there is an exception thrown like the one mentioned above,but sometime it works
why?
my ruby environment is
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Rails 3.2.8
Hello, i followed this tutorial fo setting Autlogic up properly. So, my site needs a form of level, like "Admin", "Moderator", "User", "Guest". So Admins can do everything, where Moderators may not can make site changes. And Users can't destroy, Update or Create.
I've have googled a bit.. But nothing found, so i thought you guys might can help me out?
Thank you.
I am using aptana radrails
empty rail project :
scaffold Article titre:string body:text categorie_id:integer ordre:integer
Migrate - it works fine
scaffold Categorie titre:string ordre:integer
It generate the files but when i access http://127.0.0.1:3000/categories i have the following error :
NameError in Categories#index
Showing app/views/categories/index.html.erb where line #22 raised:
undefined local variable or method `new_categorie_path' for #
Extracted source (around line #22):
19:
20:
21:
22: <%= link_to 'New categorie', new_categorie_path %
i deleted recreated my whole rails project a few times, changed categorie with another name but it keep failling. Why ?
This might sound odd, but is there a 'Rails way' to have a model destroyed if a certain attribute is blank? Say I have a model like tags with just a name attribute or something, if the user edits the tag and deletes all the text out of the name field in the form I'd like the model to just be deleted.
I'm aware of the reject_if method, but that doesn't seem to work.
check_box is hunted in rails; but I would like to select some objects and save the relationship to the database anyways. When I debug the code all I see is the value='on' instead of the value I want to save. Any Help or tutorial would be appreciated.
Configuring the PHP debuggers was so hard that I can't even imagine myself using the Rails documentation by blogging. The problem looks easy to solve: write the documenation, so why doesn't anyone do it?
Hi,
I use prototype since a long time, but for some reason I have to switch to Jquery.
I need to build a layout with resizable parts, I found http://layout.jquery-dev.net/
But I don't like the code generated, inline css is ugly.
Do you know any clean alternative? Jquery, Rails plugin or anything else
Cheers
I'm wondering what the difference is between the following two modules
# First Example
module Parent
module Child
end
end
and
# Second Example
module Parent::Child
end
Using the 2nd method, it appears as though the Parent module must be previously defined, otherwise I get an 'uninitialized constant' error
Given this, what is the preferred way of defining modules such as this and then adding nested children with regards to syntax and file structure (ie. folders etc). Reference to a Rails way would be greatly appreciated.
Are these two examples for all intents and purposes equivalent?
I am looking for a system to parallelise a large suite of tests in a Ruby on Rails app (using rspec, cucumber) that works using JRuby. Cucumber is actually not too bad, but the full rSpec suite currently takes nearly 20 minutes to run.
The systems I can find (hydra, parallel-test) look like they use forking, which isn't the ideal solution for the JRuby environment.
ruby on rails ferret search:.only 10 records are getting from table.For pagination i did it ,but only 10 records are getting even though there exists more records satisfying the search condition.if any of you know how to solve this,please reply. no limit is givenf it is not a ferret search all records are getting from table , and pagination is working
the code is:
@search_sd_ticket_result=ServiceDeskTicket.find_with_ferret(params[:sd_ticket][:servicedeskticket]).paginate :per_page =5, :page=params[:page]
I'm using prawn to generate pdfs, set up ala http://wiki.github.com/sandal/prawn/using-prawn-in-rails
I'd like to access my routes so I can generate links in my pdfs, but now I'm not in a template like I used to do with prawnto, so I don't have access to the named routes.
class MyPdf < Prawn::Document
def to_pdf
text root_path
end
end
How can I include my named routes?
I'm trying to get Rails running on a IIS 6 webserver using IronRuby, but without success. I have followed this webcast and got it running on IIS 7, but can't make it work on a IIS 6 server. I need some help to get this to work. Any ideas?
I've been trying to get autocomplete to work, however, I am getting a weird javascript error in the firebug console...
I used the https://github.com/crowdint/rails3-jquery-autocomplete gem.
The error I am getting reads: $(e).autocomplete is not a function
Here are the scripts i am including in my html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/javascripts/autocomplete-rails.js?1294035084" type="text/javascript"></script>
Thanks
hi,
anyone know how to create a suggestion box in ruby on rails? all the materials i found so far are about observe some text field and update some list in other , not related to suggestion box...
Thanks!
This is a noob question:
How do I add gems to my rails app in a way that I can just copy my app's directory structure to a remote location and have it just work, with all the gems I depend on installed and available?
Hi there
I've put some of my free time on reading/learning about cakephp but now I'm wondering if will not be better to switch completely to ruby on rails.
Can you give me the good and the bad of those tools, when is about web-development?
many thx
The Devise authentication framework uses flash notices everywhere. This makes it easy to integrate with apps but it leads to poor user experience sometimes.
I am wondering what's an easy way to selectively turn off some of the Devise flash notices in my Rails 3 app. In particular, I'd like to get rid of the blatantly obvious signed_in and signed_out flashes.
Some searching suggested subclassing the session controller or use something like this but I haven't been able to find any simple solutions to this problem.
Hi,
I have a sql script file that upon import creates a table in a MySQL database and fills it with 2800 record. These are all the postal codes for the country Belgium.
Now I would like to make a Ruby on Rails database migration file from this. Any idea how I can do this?
Thanks,
Michael
Hi,
I am planning to have something like this for a website that is on Ruby on Rails. User comes and enters a bunch of names in a text field, and a queue gets created from all the names. From there the website keeps asking more details for each one from the queue until the queue finishes.
Is there any queue management gem available in Ruby or I have to just create an array and keep incrementing the index in session variable to emulate a queue behaviour?
Hi all,
I am a seasoned .net developer and using VS.net all the time. Now, I would like to learn Ruby on Rails using emacs. Since I'm pretty new to Linux, it would be great if someone show me step by step tutorial to setup emacs for RoR develpment.
Hi,
Has anyone got any suggestions on where to start with building a google map into a rails app? I would like users to be able to add a marker by clicking the map, and have spent a few days looking for a suitable tutorial or plugin (beyond ym4r), to little avail...any help would be much appreciated!
I posted a question awhile ago asking how I could limit the rate at which a form could be submitted from a rails application. I was helped by a very patient user and their solution works great. The code was for my comments controller, and now I find myself wanting to add this functionality to another controller, my Messages controller. I immediately tried reusing the working code from the comments controller but I couldn't get it to work. Instead of asking for the working code, could someone please help me understand my working comment controller code?
class CommentsController < ApplicationController
#...
before_filter :post_check
def record_post_time
cookies[:last_post_at] = Time.now.to_i
end
def last_post_time
Time.at((cookies[:last_post_at].to_i rescue 0))
end
MIN_POST_TIME = 2.minutes
def post_check
return true if (Time.now - last_post_time) > MIN_POST_TIME
flash[:warning] = "You are trying to reply too fast."
@message = Message.find(params[:message_id])
redirect_to(@message)
return false
end
#...
def create
@message = Message.find(params[:message_id])
@comment = @message.comments.build(params[:comment])
if @comment.save
record_post_time
flash[:notice] = "Replied to \"#{@message.title}\""
redirect_to(@message)
else
render :action => "new"
end
end
def update
@message = Message.find(params[:message_id])
@comment = Comment.find(params[:id])
if @comment.update_attributes(params[:comment])
record_post_time
redirect_to post_comment_url(@message, @comment)
else
render :action => "edit"
end
end
#...
end
My Messages controller is pretty much a standard rails generated controller with a few before filters and associated private methods for DRYing up the code and a redirect for non existent pages.
I'll explain how much of the code I understand. When a comment is created, a cookie is created with a last_post_time value. If they try to post another comment, the cookie is checked if the last one was made in the last two minutes. If it was a flash warning is displayed and no comment is recorded. What I don't really understand is how the post_check method works and how I can adapt it for my simpler posts controller. I thought I could reuse all the code in the message controller with the exception of the line:
@message = Message.find(params[:message_id])
# (don't need the redirect code)
in the post_check method. But it trips up on the "record_post_time" in the create action/method. I really want to understand this. Can someone explain why this doesn't work? I greatly appreciate you reading my lengthy question.
Is it possible to override the to_sentence method just for one model in my rails application?
More generally, how do I modify methods for an Array of my models?
Can I assert rails/sinatra apps are initialized only once and all requests share the same app
instance? or do new requests spawn new app instances?
Is it possible to instance custom classes and persist them during app lifetime without using sessions, database storages or third party services? If so, what are the implications from a thread-safeness point of view?
I'm trying to figure how to implement a web-based download manager and I'm currently evaluating ruby-based frameworks.